1! RUN: %python %S/test_errors.py %s %flang_fc1 2! C929 No specifier shall appear more than once in a given 3! image-selector-spec-list. 4! C930 TEAM and TEAM_NUMBER shall not both appear in the same 5! image-selector-spec-list. 6! C931 A stat-variable in an image-selector shall not be a coindexed object. 7subroutine s1() 8 use ISO_FORTRAN_ENV 9 type(team_type) :: team1, team2 10 real :: rCoarray[10,20,*] 11 real :: rVar1, rVar2 12 integer :: iVar1, iVar2 13 integer, dimension(4) :: intArray 14 integer :: intScalarCoarray[*] 15 integer :: intCoarray[3, 4, *] 16 integer :: smallIntCoarray[4, *] 17 intCoVar = 343 18 ! OK 19 rVar1 = rCoarray[1,2,3] 20 associate (x => rCoarray) 21 rVar1 = x[1,2,3] ! also ok 22 end associate 23 !ERROR: 'rcoarray' has corank 3, but coindexed reference has 2 cosubscripts 24 rVar1 = rCoarray[1,2] 25 associate (x => rCoarray) 26 !ERROR: 'x' has corank 3, but coindexed reference has 2 cosubscripts 27 rVar1 = x[1,2] 28 end associate 29 !ERROR: Must have INTEGER type, but is REAL(4) 30 rVar1 = rCoarray[1,2,3.4] 31 !ERROR: Must have INTEGER type, but is REAL(4) 32 iVar1 = smallIntCoarray[3.4] 33 !ERROR: Must be a scalar value, but is a rank-1 array 34 rVar1 = rCoarray[1,intArray,3] 35 ! OK 36 rVar1 = rCoarray[1,2,3,STAT=iVar1, TEAM=team2] 37 !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV 38 rVar1 = rCoarray[1,2,3,STAT=iVar1, TEAM=2] 39 ! OK 40 rVar1 = rCoarray[1,2,3,STAT=iVar1, TEAM_NUMBER=38] 41 ! OK 42 rVar1 = rCoarray[1,2,3,STAT=iVar1] 43 ! OK 44 rVar1 = rCoarray[1,2,3,STAT=intArray(2)] 45 !ERROR: Must have INTEGER type, but is REAL(4) 46 rVar1 = rCoarray[1,2,3,STAT=rVar2] 47 !ERROR: Must be a scalar value, but is a rank-1 array 48 rVar1 = rCoarray[1,2,3,STAT=intArray] 49 ! Error on C929, no specifier can appear more than once 50 !ERROR: STAT variable can only be specified once 51 rVar1 = rCoarray[1,2,3,STAT=iVar1, STAT=iVar2] 52 ! OK 53 rVar1 = rCoarray[1,2,3,TEAM=team1] 54 ! Error on C929, no specifier can appear more than once 55 !ERROR: TEAM value can only be specified once 56 rVar1 = rCoarray[1,2,3,TEAM=team1, TEAM=team2] 57 ! OK 58 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=37] 59 ! OK 60 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=iVar1] 61 ! Error, team number is a scalar integer expression 62 !ERROR: Must be a scalar value, but is a rank-1 array 63 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=intArray] 64 ! Error, team number is a scalar integer expression 65 !ERROR: Must have INTEGER type, but is REAL(4) 66 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=3.7] 67 ! Error on C929, no specifier can appear more than once 68 !ERROR: TEAM_NUMBER value can only be specified once 69 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=37, TEAM_NUMBER=37] 70 !ERROR: Cannot specify both TEAM and TEAM_NUMBER 71 rVar1 = rCoarray[1,2,3,TEAM=team1, TEAM_NUMBER=37] 72 !ERROR: Cannot specify both TEAM and TEAM_NUMBER 73 rVar1 = rCoarray[1,2,3,TEAM_number=43, TEAM=team1] 74 ! OK for a STAT variable to be a coarray integer 75 rVar1 = rCoarray[1,2,3,stat=intScalarCoarray] 76 ! Error for a STAT variable to be a coindexed object 77 !ERROR: Image selector STAT variable must not be a coindexed object 78 rVar1 = rCoarray[1,2,3,stat=intCoarray[2,3, 4]] 79end subroutine s1 80