[J3] [SC22WG5.6481] Variable name lists in locality-spec
Jeff Hammond
jehammond at nvidia.com
Wed Sep 13 11:32:15 UTC 2023
On the basis of NOTE 1 and R1130, it seems the following is a legal program, but it is rejected by the Intel and NVIDIA compilers. Intel’s error message indicates it is following OpenMP’s syntax rules, which are a reasonable interpretation of the standard, but not one I can find stated in the Fortran specification.
CHARACTER (10) A, B (10)
! define A
do concurrent(integer :: i = 1 : 42 : 2) shared(A,B(1)) local(B(2:10))
B(2:10) = A(2:10)
end do
end program
Can someone explain to me the text that excludes array elements and sub-objects from locality-spec variable name lists? C1127 comes close, but since B(1) and B(2:10) are both variables describing disjoint data, I do not see how they can be considered the same name. Even though the name of the enclosing variable B is present in the name, the variable B itself is not named. One can of course construct a related example where the letter B only appears once in locality specifiers that is a subarray variable.
In short, I do not believe the specification is sufficiently clear on the relationship between array element and sub-object variables, and the variables of which they are members, in the definition of locality-spec.
Jeff
R903 variable-name is name
C903 (R903) variable-name shall be the name of a variable.
NOTE 1
For example, given the declarations:
CHARACTER (10) A, B (10)
TYPE (PERSON) P ! See 7.5.2.1, NOTE 1
NOTE 1 (cont.)
then A, B, B (1), B (1:5), P % AGE, and A (1:1) are all variables.
R1130 locality-spec is LOCAL ( variable-name-list )
or LOCAL_INIT ( variable-name-list )
or REDUCE ( reduce-operation : variable-name-list ) or SHARED ( variable-name-list )
or DEFAULT ( NONE )
C1127 The name of a variable shall not appear in more than one variable-name-list, or more than once in a variable-name-list, in a given concurrent-locality.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230913/b8b3be86/attachment.htm>
More information about the J3
mailing list