1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic 2! Tests for the index-name of a FORALL statement 3 4module m1 5 integer modVar 6end module m1 7 8program indexName 9 common /iCommonName/ x 10 type :: typeName 11 end type 12 iGlobalVar = 216 13 14contains 15 subroutine hostAssoc() 16 integer, dimension(4) :: table 17 18 ! iGlobalVar is host associated with the global variable 19 iGlobalVar = 1 20 FORALL (iGlobalVar=1:4) table(iGlobalVar) = 343 21 end subroutine hostAssoc 22 23 subroutine useAssoc() 24 use m1 25 integer, dimension(4) :: tab 26 ! modVar is use associated with the module variable 27 FORALL (modVar=1:4) tab(modVar) = 343 28 end subroutine useAssoc 29 30 subroutine constructAssoc() 31 integer, dimension(4) :: table 32 integer :: localVar 33 associate (assocVar => localVar) 34 !PORTABILITY: Index variable 'assocvar' should be a scalar object or common block if it is present in the enclosing scope 35 FORALL (assocVar=1:4) table(assocVar) = 343 36 end associate 37 end subroutine constructAssoc 38 39 subroutine commonSub() 40 integer, dimension(4) :: tab 41 ! This reference is OK 42 FORALL (iCommonName=1:4) tab(iCommonName) = 343 43 end subroutine commonSub 44 45 subroutine mismatch() 46 integer, dimension(4) :: table 47 !PORTABILITY: Index variable 'typename' should be a scalar object or common block if it is present in the enclosing scope 48 !ERROR: Must have INTEGER type, but is REAL(4) 49 !ERROR: Must have INTEGER type, but is REAL(4) 50 FORALL (typeName=1:4) table(typeName) = 343 51 end subroutine mismatch 52end program indexName 53