llvm-project/flang/test/Semantics/change_team02.f90
Peter Klausler 1dc397deed
[flang] Enforce control flow restrictions on CHANGE TEAM (#131013)
Like DO CONCURRENT and CRITICAL constructs, control flow into and out of
a CHANGE TEAM construct is disallowed.
2025-03-19 11:59:39 -07:00

25 lines
736 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
subroutine test
use, intrinsic :: iso_fortran_env, only: team_type
type(team_type) team
loop1: do j = 1, 1
goto 1 ! ok
1 construct2: change team (team)
goto 2 ! ok
exit construct2 ! ok
!ERROR: EXIT must not leave a CHANGE TEAM statement
exit loop1
!ERROR: EXIT must not leave a CHANGE TEAM statement
exit
!ERROR: CYCLE must not leave a CHANGE TEAM statement
cycle
!ERROR: RETURN statement is not allowed in a CHANGE TEAM construct
return
!ERROR: Control flow escapes from CHANGE TEAM
goto 3
!ERROR: Control flow escapes from CHANGE TEAM
write(*,*,err=3)
2 end team construct2
3 end do loop1
end