1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2 ! Tests for the index-name of a FORALL statement
15 subroutine hostAssoc()
16 integer, dimension(4) :: table
18 ! iGlobalVar is host associated with the global variable
20 FORALL (iGlobalVar
=1:4) table(iGlobalVar
) = 343
21 end subroutine hostAssoc
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
30 subroutine constructAssoc()
31 integer, dimension(4) :: table
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
37 end subroutine constructAssoc
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
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