81 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! 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 same5! 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_ENV9 save10 type(team_type) :: team1, team211 real :: rCoarray[10,20,*]12 real :: rVar1, rVar213 integer :: iVar1, iVar214 integer, dimension(4) :: intArray15 integer :: intScalarCoarray[*]16 integer :: intCoarray[3, 4, *]17 integer :: smallIntCoarray[4, *]18 intCoVar = 34319 ! OK20 rVar1 = rCoarray[1,2,3]21 associate (x => rCoarray)22 rVar1 = x[1,2,3] ! also ok23 end associate24 !ERROR: 'rcoarray' has corank 3, but coindexed reference has 2 cosubscripts25 rVar1 = rCoarray[1,2]26 associate (x => rCoarray)27 !ERROR: 'x' has corank 3, but coindexed reference has 2 cosubscripts28 rVar1 = x[1,2]29 end associate30 !ERROR: Must have INTEGER type, but is REAL(4)31 rVar1 = rCoarray[1,2,3.4]32 !ERROR: Must have INTEGER type, but is REAL(4)33 iVar1 = smallIntCoarray[3.4]34 !ERROR: Must be a scalar value, but is a rank-1 array35 rVar1 = rCoarray[1,intArray,3]36 ! OK37 rVar1 = rCoarray[1,2,3,STAT=iVar1, TEAM=team2]38 !ERROR: TEAM= specifier must have type TEAM_TYPE from ISO_FORTRAN_ENV39 rVar1 = rCoarray[1,2,3,STAT=iVar1, TEAM=2]40 ! OK41 rVar1 = rCoarray[1,2,3,STAT=iVar1, TEAM_NUMBER=38]42 ! OK43 rVar1 = rCoarray[1,2,3,STAT=iVar1]44 ! OK45 rVar1 = rCoarray[1,2,3,STAT=intArray(2)]46 !ERROR: Must have INTEGER type, but is REAL(4)47 rVar1 = rCoarray[1,2,3,STAT=rVar2]48 !ERROR: Must be a scalar value, but is a rank-1 array49 rVar1 = rCoarray[1,2,3,STAT=intArray]50 ! Error on C929, no specifier can appear more than once51 !ERROR: coindexed reference has multiple STAT= specifiers52 rVar1 = rCoarray[1,2,3,STAT=iVar1, STAT=iVar2]53 ! OK54 rVar1 = rCoarray[1,2,3,TEAM=team1]55 ! Error on C929, no specifier can appear more than once56 !ERROR: coindexed reference has multiple TEAM= or TEAM_NUMBER= specifiers57 rVar1 = rCoarray[1,2,3,TEAM=team1, TEAM=team2]58 ! OK59 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=37]60 ! OK61 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=iVar1]62 ! Error, team number is a scalar integer expression63 !ERROR: Must be a scalar value, but is a rank-1 array64 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=intArray]65 ! Error, team number is a scalar integer expression66 !ERROR: Must have INTEGER type, but is REAL(4)67 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=3.7]68 ! Error on C929, no specifier can appear more than once69 !ERROR: coindexed reference has multiple TEAM= or TEAM_NUMBER= specifiers70 rVar1 = rCoarray[1,2,3,TEAM_NUMBER=37, TEAM_NUMBER=37]71 !ERROR: coindexed reference has multiple TEAM= or TEAM_NUMBER= specifiers72 rVar1 = rCoarray[1,2,3,TEAM=team1, TEAM_NUMBER=37]73 !ERROR: coindexed reference has multiple TEAM= or TEAM_NUMBER= specifiers74 rVar1 = rCoarray[1,2,3,TEAM_number=43, TEAM=team1]75 ! OK for a STAT variable to be a coarray integer76 rVar1 = rCoarray[1,2,3,stat=intScalarCoarray]77 ! Error for a STAT variable to be a coindexed object78 !ERROR: Image selector STAT variable must not be a coindexed object79 rVar1 = rCoarray[1,2,3,stat=intCoarray[2,3, 4]]80end subroutine s181