1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 !A variable that is referenced by the scalar-mask-expr of a
4 !concurrent-header or by any concurrent-limit or concurrent-step in that
5 !concurrent-header shall not appear in a LOCAL locality-spec in the same DO
10 !ERROR: 'i' is already declared in this scoping unit
11 do concurrent (i
=1:10) local(i
)
16 !ERROR: 'i' is already declared in this scoping unit
17 do concurrent (i
=1:10) local_init(i
)
22 !ERROR: DO CONCURRENT expression references variable 'i' in LOCAL locality-spec
23 do concurrent (j
=i
:10) local(i
)
28 !OK because the locality-spec is local_init
29 do concurrent (j
=i
:10) local_init(i
)
34 !OK because the locality-spec is shared
35 do concurrent (j
=i
:10) shared(i
)
40 !ERROR: DO CONCURRENT expression references variable 'i' in LOCAL locality-spec
41 do concurrent (j
=1:i
) local(i
)
46 !OK because the locality-spec is local_init
47 do concurrent (j
=1:i
) local_init(i
)
52 !OK because the locality-spec is shared
53 do concurrent (j
=1:i
) shared(i
)
58 !ERROR: DO CONCURRENT expression references variable 'i' in LOCAL locality-spec
59 do concurrent (j
=1:10:i
) local(i
)
64 !OK because the locality-spec is local_init
65 do concurrent (j
=1:10:i
) local_init(i
)
70 !OK because the locality-spec is shared
71 do concurrent (j
=1:10:i
) shared(i
)
76 ! Test construct-association, in this case, established by the "shared"
78 associate (avar
=> ivar
)
79 !ERROR: DO CONCURRENT expression references variable 'ivar' in LOCAL locality-spec
80 do concurrent (j
=1:10:avar
) local(avar
)
89 ! Test use-association, in this case, established by the "shared"
92 !ERROR: DO CONCURRENT expression references variable 'mvar' in LOCAL locality-spec
93 do concurrent (k
=mvar
:10) local(mvar
)
98 ! Test host-association, in this case, established by the "shared"
101 do concurrent (j
=ivar
:10) shared(ivar
)
102 !ERROR: DO CONCURRENT expression references variable 'ivar' in LOCAL locality-spec
103 do concurrent (k
=ivar
:10) local(ivar
)