53 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Tests for the index-name of a FORALL statement3 4module m15 integer modVar6end module m17 8program indexName9 common /iCommonName/ x10 type :: typeName11 end type12 iGlobalVar = 21613 14contains15 subroutine hostAssoc()16 integer, dimension(4) :: table17 18 ! iGlobalVar is host associated with the global variable19 iGlobalVar = 120 FORALL (iGlobalVar=1:4) table(iGlobalVar) = 34321 end subroutine hostAssoc22 23 subroutine useAssoc()24 use m125 integer, dimension(4) :: tab26 ! modVar is use associated with the module variable27 FORALL (modVar=1:4) tab(modVar) = 34328 end subroutine useAssoc29 30 subroutine constructAssoc()31 integer, dimension(4) :: table32 integer :: localVar33 associate (assocVar => localVar)34 !PORTABILITY: Index variable 'assocvar' should be a scalar object or common block if it is present in the enclosing scope [-Wodd-index-variable-restrictions]35 FORALL (assocVar=1:4) table(assocVar) = 34336 end associate37 end subroutine constructAssoc38 39 subroutine commonSub()40 integer, dimension(4) :: tab41 ! This reference is OK42 FORALL (iCommonName=1:4) tab(iCommonName) = 34343 end subroutine commonSub44 45 subroutine mismatch()46 integer, dimension(4) :: table47 !PORTABILITY: Index variable 'typename' should be a scalar object or common block if it is present in the enclosing scope [-Wodd-index-variable-restrictions]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) = 34351 end subroutine mismatch52end program indexName53