# Execution Segments for Images

On each image, a segment is the sequence of statements executed before the first execution of an image control statement, between the execution of two image control statements, or after the last execution of an image control statement.

The segment executed immediately before the execution of an image control statement includes the evaluation of all expressions within that image control statement.

A coarray can be referenced or defined by execution of an atomic subroutine during the execution of a segment that is unordered, relative to the execution of a segment in which the coarray is referenced or defined by execution of an atomic subroutine. An event variable can be referenced or defined during the execution of a segment that is unordered relative to the execution of another segment in which that event variable is defined. Otherwise, the following rules apply:

- If a variable is defined on an image in a segment, it must not be referenced, defined, or become undefined in a segment on another image unless the segments are ordered.

- If the allocation of an allocatable subobject of a coarray or the pointer association of a pointer subobject of a coarray is changed on an image in a segment, that subobject must not be referenced or defined in a segment on another image unless the segments are ordered.

- If a procedure invocation on image P is in execution in segments Pi, Pi+1, ..., Pk and defines a noncoarray dummy argument, the effective argument must not be referenced, defined, or become undefined on another image Q in a segment Qj unless Qj precedes Pi or succeeds Pk (because a copy of the actual argument may be passed to the procedure)

Incorrect sequencing of image control statements can suspend execution indefinitely. For example, one image might be executing a SYNC ALL statement while another is executing an ALLOCATE statement for a coarray.

Parent topic: Image Control Statements

## See Also

Image Control Statements