72 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in change team statements.3! Only those semantics which differ from those of FORM TEAM statements are checked.4 5subroutine test6 use, intrinsic :: iso_fortran_env, only: team_type7 save8 type(team_type) :: team9 integer, codimension[*] :: selector10 integer, codimension[2,*] :: selector2d11 12 ! Valid invocations which should produce no errors.13 block14 change team (team)15 end team16 construct1: change team (team)17 end team construct118 change team (team, ca[*] => selector)19 end team20 change team (team, ca[2,*] => selector)21 end team22 change team (team, ca[*] => selector)23 end team24 change team (team, ca[*] => selector, ca2[2,*] => selector2d)25 end team26 end block27 28 !A selector may appear only once in selector-list.29 ! ERROR: Selector 'selector' was already used as a selector or coarray in this statement30 change team (team, ca[*] => selector, ca2[*] => selector)31 end team32 33 ! Within a CHANGE TEAM construct, a CYCLE or EXIT statement is not allowed if it belongs to an outer construct.34 block35 outer1: if (.true.) then36 change team (team)37 if (.true.) then38 ! ERROR: EXIT must not leave a CHANGE TEAM statement39 exit outer140 end if41 end team42 end if outer143 end block44 block45 outer2: do46 change team (team)47 ! ERROR: CYCLE must not leave a CHANGE TEAM statement48 cycle outer249 end team50 end do outer251 end block52 53 ! The construct name must not be the same as any other construct name in the scoping unit.54 block55 construct2: block56 end block construct257 ! ERROR: 'construct2' is already declared in this scoping unit58 construct2: change team (team)59 end team construct260 end block61 62 ! When the CHANGE TEAM statement is executed, the selectors must all be established coarrays.63 ! ERROR: Selector in coarray association must name a coarray64 change team (team, ca[*] => not_selector)65 end team66 67 ! The coarray name in a coarray-association must not be the same as the name as the name of another coarray or of a selector in the CHANGE TEAM statement.68 ! ERROR: 'selector' is not an object that can appear in an expression69 change team (team, selector[*] => selector)70 end team71end subroutine72