1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! C1135 A cycle-stmt shall not appear within a CHANGE TEAM, CRITICAL, or DO
4 ! CONCURRENT construct if it belongs to an outer construct.
6 ! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if
7 ! it belongs to that construct or an outer construct.
9 ! C1168 -- An exit-stmt shall not appear within a CHANGE TEAM or CRITICAL
10 ! construct if it belongs to an outer construct.
13 !ERROR: No matching DO construct for CYCLE statement
18 !ERROR: No matching construct for EXIT statement
24 !ERROR: No matching DO construct for CYCLE statement
31 level1
: do concurrent (j
= 1:20)
32 !ERROR: CYCLE must not leave a DO CONCURRENT statement
40 level1
: do concurrent (j
= 1:20)
41 !ERROR: EXIT must not leave a DO CONCURRENT statement
50 !ERROR: CYCLE must not leave a CRITICAL statement
59 !ERROR: EXIT must not leave a CRITICAL statement
66 use :: iso_fortran_env
67 type(team_type
) team_var
70 level1
: change
team(team_var
)
71 !ERROR: CYCLE must not leave a CHANGE TEAM statement
78 use :: iso_fortran_env
79 type(team_type
) team_var
82 level1
: change
team(team_var
)
83 !ERROR: EXIT must not leave a CHANGE TEAM statement
90 ! A complex, but all legal example
98 type, extends(point
) :: color_point
102 type(point
), target
:: target_var
103 class(point
), pointer :: p_or_c
107 level1
: associate (avar
=> ivar
)
109 level3
: select
case (l
)
113 level4
: if (.true
.) then
114 level5
: select
rank(table
)
116 level6
: select
type ( a
=> p_or_c
)
128 subroutine s11(table
)
129 ! A complex, but all legal example with a CYCLE statement
137 type, extends(point
) :: color_point
141 type(point
), target
:: target_var
142 class(point
), pointer :: p_or_c
146 level1
: associate (avar
=> ivar
)
148 level3
: select
case (l
)
152 level4
: if (.true
.) then
153 level5
: select
rank(table
)
155 level6
: select
type ( a
=> p_or_c
)
167 subroutine s12(table
)
168 ! A complex, but all legal example with an EXIT statement
176 type, extends(point
) :: color_point
180 type(point
), target
:: target_var
181 class(point
), pointer :: p_or_c
185 level1
: associate (avar
=> ivar
)
187 level3
: select
case (l
)
191 level4
: if (.true
.) then
192 level5
: select
rank(table
)
194 level6
: select
type ( a
=> p_or_c
)
206 subroutine s13(table
)
207 ! Similar example without construct names
215 type, extends(point
) :: color_point
219 type(point
), target
:: target_var
220 class(point
), pointer :: p_or_c
224 associate (avar
=> ivar
)
233 select
type ( a
=> p_or_c
)
245 subroutine s14(table
)
253 type, extends(point
) :: color_point
257 type(point
), target
:: target_var
258 class(point
), pointer :: p_or_c
262 associate (avar
=> ivar
)
272 select
type ( a
=> p_or_c
)
274 !ERROR: CYCLE must not leave a CRITICAL statement
276 !ERROR: EXIT must not leave a CRITICAL statement
288 subroutine s15(table
)
289 ! Illegal EXIT to an intermediated construct
297 type, extends(point
) :: color_point
301 type(point
), target
:: target_var
302 class(point
), pointer :: p_or_c
306 level1
: associate (avar
=> ivar
)
308 level3
: select
case (l
)
312 level4
: if (.true
.) then
314 level6
: select
rank(table
)
316 level7
: select
type ( a
=> p_or_c
)
319 !ERROR: EXIT must not leave a CRITICAL statement