1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 ! A reference to the procedure IEEE_SET_HALTING_MODE ! from the intrinsic
4 ! module IEEE_EXCEPTIONS, shall not ! appear within a DO CONCURRENT construct.
7 ! An image control statement shall not appear within a DO CONCURRENT construct.
10 ! A RETURN statement shall not appear within a DO CONCURRENT construct.
12 ! (11.1.7.5), paragraph 4
13 ! In a DO CONCURRENT, can't have an i/o statement with an ADVANCE= specifier
15 subroutine do_concurrent_test1(i
,n
)
18 do 10 concurrent (i
= 1:n
)
19 !ERROR: An image control statement is not allowed in DO CONCURRENT
21 !ERROR: An image control statement is not allowed in DO CONCURRENT
23 !ERROR: An image control statement is not allowed in DO CONCURRENT
25 !ERROR: An image control statement is not allowed in DO CONCURRENT
27 !ERROR: An image control statement is not allowed in DO CONCURRENT
30 !ERROR: RETURN is not allowed in DO CONCURRENT
33 end subroutine do_concurrent_test1
35 subroutine do_concurrent_test2(i
,j
,n
,flag
)
37 use iso_fortran_env
, only
: team_type
40 type(ieee_flag_type
) :: flag
41 logical :: flagValue
, halting
43 type(ieee_status_type
) :: status
44 do concurrent (i
= 1:n
)
45 !ERROR: An image control statement is not allowed in DO CONCURRENT
47 !ERROR: An image control statement is not allowed in DO CONCURRENT
49 !ERROR: An image control statement is not allowed in DO CONCURRENT
53 !ERROR: ADVANCE specifier is not allowed in DO CONCURRENT
54 write(*,'(a35)',advance
='no')
55 !ERROR: 'ieee_get_status' may not be called in DO CONCURRENT
56 call ieee_get_status(status
)
57 !ERROR: 'ieee_set_status' may not be called in DO CONCURRENT
58 call ieee_set_status(status
)
59 !ERROR: 'ieee_get_halting_mode' may not be called in DO CONCURRENT
60 call ieee_get_halting_mode(flag
, halting
)
61 !ERROR: 'ieee_set_halting_mode' may not be called in DO CONCURRENT
62 call ieee_set_halting_mode(flag
, halting
)
63 !ERROR: 'ieee_get_flag' may not be called in DO CONCURRENT
64 call ieee_get_flag(flag
, flagValue
)
65 !ERROR: 'ieee_set_flag' may not be called in DO CONCURRENT
66 call ieee_set_flag(flag
, flagValue
)
68 end subroutine do_concurrent_test2
72 type(event_type
) :: x
[*]
73 do concurrent (i
= 1:n
)
74 !ERROR: An image control statement is not allowed in DO CONCURRENT
81 type(event_type
) :: x
[*]
82 do concurrent (i
= 1:n
)
83 !ERROR: An image control statement is not allowed in DO CONCURRENT
92 do concurrent (i
= 1:n
)
93 !ERROR: An image control statement is not allowed in DO CONCURRENT
102 do concurrent (i
= 1:n
)
103 !ERROR: An image control statement is not allowed in DO CONCURRENT
105 !ERROR: An image control statement is not allowed in DO CONCURRENT
111 do concurrent (i
= 1:n
)
112 !ERROR: An image control statement is not allowed in DO CONCURRENT
119 integer, allocatable
, dimension(:) :: type0_field
120 integer, allocatable
, dimension(:), codimension
[:] :: coarray_type0_field
124 type(type0
) :: type1_field
129 integer, allocatable
, dimension(:) :: array1
130 integer, allocatable
, dimension(:) :: array2
131 integer, allocatable
, codimension
[:] :: ca
, cb
132 integer, allocatable
:: aa
, ab
134 ! All of the following are allowable outside a DO CONCURRENT
135 allocate(array1(3), pvar
%type1_field
%type0_field(3), array2(9))
136 allocate(pvar
%type1_field
%coarray_type0_field(3)[*])
138 allocate(ca
[*], pvar
%type1_field
%coarray_type0_field(3)[*])
140 do concurrent (i
= 1:10)
141 allocate(pvar
%type1_field
%type0_field(3))
144 do concurrent (i
= 1:10)
145 !ERROR: An image control statement is not allowed in DO CONCURRENT
149 do concurrent (i
= 1:10)
150 !ERROR: An image control statement is not allowed in DO CONCURRENT
154 do concurrent (i
= 1:10)
155 !ERROR: An image control statement is not allowed in DO CONCURRENT
156 allocate(pvar
%type1_field
%coarray_type0_field(3)[*])
159 do concurrent (i
= 1:10)
160 !ERROR: An image control statement is not allowed in DO CONCURRENT
161 deallocate(pvar
%type1_field
%coarray_type0_field
)
164 do concurrent (i
= 1:10)
165 !ERROR: An image control statement is not allowed in DO CONCURRENT
166 allocate(ca
[*], pvar
%type1_field
%coarray_type0_field(3)[*])
169 do concurrent (i
= 1:10)
170 !ERROR: An image control statement is not allowed in DO CONCURRENT
171 deallocate(ca
, pvar
%type1_field
%coarray_type0_field
)
174 ! Call to MOVE_ALLOC of a coarray outside a DO CONCURRENT. This is OK.
175 call move_alloc(ca
, cb
)
177 ! Call to MOVE_ALLOC with non-coarray arguments in a DO CONCURRENT. This is OK.
179 do concurrent (i
= 1:10)
180 call move_alloc(aa
, ab
)
183 do concurrent (i
= 1:10)
184 !ERROR: An image control statement is not allowed in DO CONCURRENT
185 call move_alloc(ca
, cb
)
188 do concurrent (i
= 1:10)
189 !ERROR: An image control statement is not allowed in DO CONCURRENT
190 call move_alloc(pvar
%type1_field
%coarray_type0_field
, qvar
%type1_field
%coarray_type0_field
)
196 pure
integer function pf()
200 impure
integer function ipf()
204 type :: procTypeNotPure
205 procedure(notPureFunc
), pointer, nopass
:: notPureProcComponent
206 end type procTypeNotPure
209 procedure(pf
), pointer, nopass
:: pureProcComponent
210 end type procTypePure
212 type(procTypeNotPure
) :: procVarNotPure
213 type(procTypePure
) :: procVarPure
216 procVarPure
%pureProcComponent
=> pureFunc
218 do concurrent (i
= 1:10)
222 do concurrent (i
= 1:10)
226 ! This should not generate errors
227 do concurrent (i
= 1:10)
228 ivar
= procVarPure
%pureProcComponent()
231 ! This should generate an error
232 do concurrent (i
= 1:10)
233 !ERROR: Impure procedure 'notpureproccomponent' may not be referenced in DO CONCURRENT
234 ivar
= procVarNotPure
%notPureProcComponent()
237 ! This should generate an error
238 do concurrent (i
= 1:10)
239 !ERROR: Impure procedure 'ipf' may not be referenced in DO CONCURRENT
244 integer function notPureFunc()
246 end function notPureFunc
248 pure
integer function pureFunc()
250 end function pureFunc
258 generic
:: assignment(=) => tbpAssign
260 interface assignment(=)
261 module procedure nonTbpAssign
264 impure elemental
subroutine tbpAssign(to, from
)
265 class(t
), intent(out
) :: to
266 class(t
), intent(in
) :: from
267 print *, 'impure due to I/O'
269 impure elemental
subroutine nonTbpAssign(to, from
)
270 type(t
), intent(out
) :: to
271 integer, intent(in
) :: from
272 print *, 'impure due to I/O'
276 do concurrent (j
=1:1)
277 !ERROR: The defined assignment subroutine 'tbpassign' is not pure
279 !ERROR: The defined assignment subroutine 'nontbpassign' is not pure