1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
4 ! A reference to the procedure IEEE_SET_HALTING_MODE ! from the intrinsic
5 ! module IEEE_EXCEPTIONS, shall not ! appear within a DO CONCURRENT construct.
8 ! An image control statement shall not appear within a DO CONCURRENT construct.
11 ! A RETURN statement shall not appear within a DO CONCURRENT construct.
13 ! (11.1.7.5), paragraph 4
14 ! In a DO CONCURRENT, can't have an i/o statement with an ADVANCE= specifier
16 subroutine do_concurrent_test1(i
,n
)
19 do 10 concurrent (i
= 1:n
)
20 !ERROR: An image control statement is not allowed in DO CONCURRENT
22 !ERROR: An image control statement is not allowed in DO CONCURRENT
24 !ERROR: An image control statement is not allowed in DO CONCURRENT
26 !ERROR: RETURN is not allowed in DO CONCURRENT
29 end subroutine do_concurrent_test1
31 subroutine do_concurrent_test2(i
,j
,n
,flag
)
33 use iso_fortran_env
, only
: team_type
36 type(ieee_flag_type
) :: flag
37 logical :: flagValue
, halting
39 type(ieee_status_type
) :: status
40 do concurrent (i
= 1:n
)
41 !ERROR: An image control statement is not allowed in DO CONCURRENT
43 !ERROR: An image control statement is not allowed in DO CONCURRENT
45 !ERROR: An image control statement is not allowed in DO CONCURRENT
47 !ERROR: Call to an impure procedure is not allowed in DO CONCURRENT
48 call ieee_get_status(status
)
49 !ERROR: IEEE_SET_HALTING_MODE is not allowed in DO CONCURRENT
50 call ieee_set_halting_mode(flag
, halting
)
53 !ERROR: ADVANCE specifier is not allowed in DO CONCURRENT
54 write(*,'(a35)',advance
='no')
58 do concurrent (i
= 1:n
)
59 call ieee_set_flag(flag
, flagValue
)
61 end subroutine do_concurrent_test2
66 do concurrent (i
= 1:n
)
67 !ERROR: An image control statement is not allowed in DO CONCURRENT
75 do concurrent (i
= 1:n
)
76 !ERROR: An image control statement is not allowed in DO CONCURRENT
85 do concurrent (i
= 1:n
)
86 !ERROR: An image control statement is not allowed in DO CONCURRENT
95 do concurrent (i
= 1:n
)
96 !ERROR: An image control statement is not allowed in DO CONCURRENT
98 !ERROR: An image control statement is not allowed in DO CONCURRENT
104 do concurrent (i
= 1:n
)
105 !ERROR: An image control statement is not allowed in DO CONCURRENT
112 integer, allocatable
, dimension(:) :: type0_field
113 integer, allocatable
, dimension(:), codimension
[:] :: coarray_type0_field
117 type(type0
) :: type1_field
122 integer, allocatable
, dimension(:) :: array1
123 integer, allocatable
, dimension(:) :: array2
124 integer, allocatable
, codimension
[:] :: ca
, cb
125 integer, allocatable
:: aa
, ab
127 ! All of the following are allowable outside a DO CONCURRENT
128 allocate(array1(3), pvar
%type1_field
%type0_field(3), array2(9))
129 allocate(pvar
%type1_field
%coarray_type0_field(3)[*])
131 allocate(ca
[*], pvar
%type1_field
%coarray_type0_field(3)[*])
133 do concurrent (i
= 1:10)
134 allocate(pvar
%type1_field
%type0_field(3))
137 do concurrent (i
= 1:10)
138 !ERROR: An image control statement is not allowed in DO CONCURRENT
142 do concurrent (i
= 1:10)
143 !ERROR: An image control statement is not allowed in DO CONCURRENT
147 do concurrent (i
= 1:10)
148 !ERROR: An image control statement is not allowed in DO CONCURRENT
149 allocate(pvar
%type1_field
%coarray_type0_field(3)[*])
152 do concurrent (i
= 1:10)
153 !ERROR: An image control statement is not allowed in DO CONCURRENT
154 deallocate(pvar
%type1_field
%coarray_type0_field
)
157 do concurrent (i
= 1:10)
158 !ERROR: An image control statement is not allowed in DO CONCURRENT
159 allocate(ca
[*], pvar
%type1_field
%coarray_type0_field(3)[*])
162 do concurrent (i
= 1:10)
163 !ERROR: An image control statement is not allowed in DO CONCURRENT
164 deallocate(ca
, pvar
%type1_field
%coarray_type0_field
)
167 ! Call to MOVE_ALLOC of a coarray outside a DO CONCURRENT. This is OK.
168 call move_alloc(ca
, cb
)
170 ! Call to MOVE_ALLOC with non-coarray arguments in a DO CONCURRENT. This is OK.
172 do concurrent (i
= 1:10)
173 call move_alloc(aa
, ab
)
176 do concurrent (i
= 1:10)
177 !ERROR: An image control statement is not allowed in DO CONCURRENT
178 call move_alloc(ca
, cb
)
181 do concurrent (i
= 1:10)
182 !ERROR: An image control statement is not allowed in DO CONCURRENT
183 call move_alloc(pvar
%type1_field
%coarray_type0_field
, qvar
%type1_field
%coarray_type0_field
)
189 pure
integer function pf()
193 type :: procTypeNotPure
194 procedure(notPureFunc
), pointer, nopass
:: notPureProcComponent
195 end type procTypeNotPure
198 procedure(pf
), pointer, nopass
:: pureProcComponent
199 end type procTypePure
201 type(procTypeNotPure
) :: procVarNotPure
202 type(procTypePure
) :: procVarPure
205 procVarPure
%pureProcComponent
=> pureFunc
207 do concurrent (i
= 1:10)
211 do concurrent (i
= 1:10)
215 ! This should not generate errors
216 do concurrent (i
= 1:10)
217 ivar
= procVarPure
%pureProcComponent()
220 ! This should generate an error
221 do concurrent (i
= 1:10)
222 !ERROR: Call to an impure procedure component is not allowed in DO CONCURRENT
223 ivar
= procVarNotPure
%notPureProcComponent()
227 integer function notPureFunc()
229 end function notPureFunc
231 pure
integer function pureFunc()
233 end function pureFunc