1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C1135 A cycle-stmt shall not appear within a CHANGE TEAM, CRITICAL, or DO
3 ! CONCURRENT construct if it belongs to an outer construct.
5 ! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if
6 ! it belongs to that construct or an outer construct.
8 ! C1168 -- An exit-stmt shall not appear within a CHANGE TEAM or CRITICAL
9 ! construct if it belongs to an outer construct.
12 !ERROR: No matching DO construct for CYCLE statement
17 !ERROR: No matching construct for EXIT statement
23 !ERROR: No matching DO construct for CYCLE statement
30 level1
: do concurrent (j
= 1:20)
31 !ERROR: CYCLE must not leave a DO CONCURRENT statement
39 level1
: do concurrent (j
= 1:20)
40 !ERROR: EXIT must not leave a DO CONCURRENT statement
49 !ERROR: CYCLE must not leave a CRITICAL statement
58 !ERROR: EXIT must not leave a CRITICAL statement
65 use :: iso_fortran_env
66 type(team_type
) team_var
69 level1
: change
team(team_var
)
70 !ERROR: CYCLE must not leave a CHANGE TEAM statement
77 use :: iso_fortran_env
78 type(team_type
) team_var
81 level1
: change
team(team_var
)
82 !ERROR: EXIT must not leave a CHANGE TEAM statement
89 ! A complex, but all legal example
97 type, extends(point
) :: color_point
101 type(point
), target
:: target_var
102 class(point
), pointer :: p_or_c
106 level1
: associate (avar
=> ivar
)
108 level3
: select
case (l
)
112 level4
: if (.true
.) then
113 level5
: select
rank(table
)
115 level6
: select
type ( a
=> p_or_c
)
127 subroutine s11(table
)
128 ! A complex, but all legal example with a CYCLE statement
136 type, extends(point
) :: color_point
140 type(point
), target
:: target_var
141 class(point
), pointer :: p_or_c
145 level1
: associate (avar
=> ivar
)
147 level3
: select
case (l
)
151 level4
: if (.true
.) then
152 level5
: select
rank(table
)
154 level6
: select
type ( a
=> p_or_c
)
166 subroutine s12(table
)
167 ! A complex, but all legal example with an EXIT statement
175 type, extends(point
) :: color_point
179 type(point
), target
:: target_var
180 class(point
), pointer :: p_or_c
184 level1
: associate (avar
=> ivar
)
186 level3
: select
case (l
)
190 level4
: if (.true
.) then
191 level5
: select
rank(table
)
193 level6
: select
type ( a
=> p_or_c
)
205 subroutine s13(table
)
206 ! Similar example without construct names
214 type, extends(point
) :: color_point
218 type(point
), target
:: target_var
219 class(point
), pointer :: p_or_c
223 associate (avar
=> ivar
)
232 select
type ( a
=> p_or_c
)
244 subroutine s14(table
)
252 type, extends(point
) :: color_point
256 type(point
), target
:: target_var
257 class(point
), pointer :: p_or_c
261 associate (avar
=> ivar
)
271 select
type ( a
=> p_or_c
)
273 !ERROR: CYCLE must not leave a CRITICAL statement
275 !ERROR: EXIT must not leave a CRITICAL statement
287 subroutine s15(table
)
288 ! Illegal EXIT to an intermediated construct
296 type, extends(point
) :: color_point
300 type(point
), target
:: target_var
301 class(point
), pointer :: p_or_c
305 level1
: associate (avar
=> ivar
)
307 level3
: select
case (l
)
311 level4
: if (.true
.) then
313 level6
: select
rank(table
)
315 level7
: select
type ( a
=> p_or_c
)
318 !ERROR: EXIT must not leave a CRITICAL statement