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: RETURN is not allowed in DO CONCURRENT
28 end subroutine do_concurrent_test1
30 subroutine do_concurrent_test2(i
,j
,n
,flag
)
32 use iso_fortran_env
, only
: team_type
35 type(ieee_flag_type
) :: flag
36 logical :: flagValue
, halting
38 type(ieee_status_type
) :: status
39 do concurrent (i
= 1:n
)
40 !ERROR: An image control statement is not allowed in DO CONCURRENT
42 !ERROR: An image control statement is not allowed in DO CONCURRENT
44 !ERROR: An image control statement is not allowed in DO CONCURRENT
46 !ERROR: Call to an impure procedure is not allowed in DO CONCURRENT
47 call ieee_get_status(status
)
48 !ERROR: IEEE_SET_HALTING_MODE is not allowed in DO CONCURRENT
49 call ieee_set_halting_mode(flag
, halting
)
52 !ERROR: ADVANCE specifier is not allowed in DO CONCURRENT
53 write(*,'(a35)',advance
='no')
57 do concurrent (i
= 1:n
)
58 call ieee_set_flag(flag
, flagValue
)
60 end subroutine do_concurrent_test2
65 do concurrent (i
= 1:n
)
66 !ERROR: An image control statement is not allowed in DO CONCURRENT
74 do concurrent (i
= 1:n
)
75 !ERROR: An image control statement is not allowed in DO CONCURRENT
84 do concurrent (i
= 1:n
)
85 !ERROR: An image control statement is not allowed in DO CONCURRENT
94 do concurrent (i
= 1:n
)
95 !ERROR: An image control statement is not allowed in DO CONCURRENT
97 !ERROR: An image control statement is not allowed in DO CONCURRENT
103 do concurrent (i
= 1:n
)
104 !ERROR: An image control statement is not allowed in DO CONCURRENT
111 integer, allocatable
, dimension(:) :: type0_field
112 integer, allocatable
, dimension(:), codimension
[:] :: coarray_type0_field
116 type(type0
) :: type1_field
121 integer, allocatable
, dimension(:) :: array1
122 integer, allocatable
, dimension(:) :: array2
123 integer, allocatable
, codimension
[:] :: ca
, cb
124 integer, allocatable
:: aa
, ab
126 ! All of the following are allowable outside a DO CONCURRENT
127 allocate(array1(3), pvar
%type1_field
%type0_field(3), array2(9))
128 allocate(pvar
%type1_field
%coarray_type0_field(3)[*])
130 allocate(ca
[*], pvar
%type1_field
%coarray_type0_field(3)[*])
132 do concurrent (i
= 1:10)
133 allocate(pvar
%type1_field
%type0_field(3))
136 do concurrent (i
= 1:10)
137 !ERROR: An image control statement is not allowed in DO CONCURRENT
141 do concurrent (i
= 1:10)
142 !ERROR: An image control statement is not allowed in DO CONCURRENT
146 do concurrent (i
= 1:10)
147 !ERROR: An image control statement is not allowed in DO CONCURRENT
148 allocate(pvar
%type1_field
%coarray_type0_field(3)[*])
151 do concurrent (i
= 1:10)
152 !ERROR: An image control statement is not allowed in DO CONCURRENT
153 deallocate(pvar
%type1_field
%coarray_type0_field
)
156 do concurrent (i
= 1:10)
157 !ERROR: An image control statement is not allowed in DO CONCURRENT
158 allocate(ca
[*], pvar
%type1_field
%coarray_type0_field(3)[*])
161 do concurrent (i
= 1:10)
162 !ERROR: An image control statement is not allowed in DO CONCURRENT
163 deallocate(ca
, pvar
%type1_field
%coarray_type0_field
)
166 ! Call to MOVE_ALLOC of a coarray outside a DO CONCURRENT. This is OK.
167 call move_alloc(ca
, cb
)
169 ! Call to MOVE_ALLOC with non-coarray arguments in a DO CONCURRENT. This is OK.
171 do concurrent (i
= 1:10)
172 call move_alloc(aa
, ab
)
175 do concurrent (i
= 1:10)
176 !ERROR: An image control statement is not allowed in DO CONCURRENT
177 call move_alloc(ca
, cb
)
180 do concurrent (i
= 1:10)
181 !ERROR: An image control statement is not allowed in DO CONCURRENT
182 call move_alloc(pvar
%type1_field
%coarray_type0_field
, qvar
%type1_field
%coarray_type0_field
)
188 pure
integer function pf()
192 type :: procTypeNotPure
193 procedure(notPureFunc
), pointer, nopass
:: notPureProcComponent
194 end type procTypeNotPure
197 procedure(pf
), pointer, nopass
:: pureProcComponent
198 end type procTypePure
200 type(procTypeNotPure
) :: procVarNotPure
201 type(procTypePure
) :: procVarPure
204 procVarPure
%pureProcComponent
=> pureFunc
206 do concurrent (i
= 1:10)
210 do concurrent (i
= 1:10)
214 ! This should not generate errors
215 do concurrent (i
= 1:10)
216 ivar
= procVarPure
%pureProcComponent()
219 ! This should generate an error
220 do concurrent (i
= 1:10)
221 !ERROR: Call to an impure procedure component is not allowed in DO CONCURRENT
222 ivar
= procVarNotPure
%notPureProcComponent()
226 integer function notPureFunc()
228 end function notPureFunc
230 pure
integer function pureFunc()
232 end function pureFunc