Is this program conforming?
integer :: i(4)[*]
i = this_image()
sync all
if ( this_image() .gt. 1 ) i(1) = i(3)[ this_image() - 1 ]
if ( this_image() .lt. num_images() ) i(4) = i(2)[ this_image() + 1 ]
sync all
write (*,*) this_image(), i
end
It seems to violate CD 11.6.2p3 bullet point 1:
"if a variable is defined or becomes undefined on an image in
a segment, it shall not be referenced, defined, or become
undefined in a segment on another image unless the segments are
ordered". Variable i is defined and referenced in unordered
segments, so this makes the code not conforming.
However, Note 9.1 of CD, p131 says
that an array element is also a variable.
In this case the above restriction
has not been broken because
i(1) and i(4) are defined but not referenced, and
i(2) and i(3) are referenced but not defined.
So what should be understood as a variable
in this example - element of array i
or the whole array i?
Thanks
Anton
|