[flang] Treat pre-processed input as fixed (#117563)
[llvm-project.git] / flang / test / Semantics / resolve99.f90
blobe56022b61bfd831e90fcc1ed4a010d03d614e322
1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2 ! Tests for the index-name of a FORALL statement
4 module m1
5 integer modVar
6 end module m1
8 program indexName
9 common /iCommonName/ x
10 type :: typeName
11 end type
12 iGlobalVar = 216
14 contains
15 subroutine hostAssoc()
16 integer, dimension(4) :: table
18 ! iGlobalVar is host associated with the global variable
19 iGlobalVar = 1
20 FORALL (iGlobalVar=1:4) table(iGlobalVar) = 343
21 end subroutine hostAssoc
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
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
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
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
52 end program indexName