To: J3 09-199r1 From: John Reid Subject: NOTE 8.31 and NOTE 8.32 Date: 2009 May 5 References: J3/09-007r1 Discussion NOTE 8.31 states Apart from the effects of volatile variables, the processor may optimize the execution of a segment as if it were the only image in execution. Unfortunately, this is not quite correct. It must not perform an optimization that might break the rule about definitions and references in unordered segments. For example, consider the code integer (kind=short) x(8)[*] : ! Computation that references and alters x(1:7) : The compiler must not effectively make this replacement integer (kind=short) x(8)[*], temp(8) : temp(1:8) = x(1:8) ! Faster than temp(1:7) = x(1:7) ! Computation that references and alters temp(1:7) x(1:8) = temp(1:8) because another image might reference x(8) in a segment that is unordered with respect to this one. NOTE 8.32 needs to be revised to take account of executions of atomic subroutines. Edits are provided to correct these notes. Edits to 09-007r1 [190:23+] In 8.5.2, Segments, replace the body of NOTE 8.31 by Because of the restrictions on references and definitions in unordered segments, the processor may apply code motion optimizations within a segment as if it were the only image in execution, provided calls of atomic subroutines are not involved." [190:23+] In 8.5.2, Segments, NOTE 8.32. Start a new para after the first sentence and change "In practice," to "In practice, apart from executions of atomic subroutines,". In the final sentence, change "would" to "might". At the end of the note, add new para: "An execution of an atomic subroutine references the permanent memory location of its ATOM argument directly."