Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / resolve99.f90
bloba2dd41cefd0e211f3d14e7aaf4f316b1d59f254e
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
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 ! assocVar is construct associated with localVar
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 !ERROR: Index name 'typename' conflicts with existing identifier
48 FORALL (typeName=1:4) table(typeName) = 343
49 end subroutine mismatch
50 end program indexName