Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / symbol05.f90
bloba2781ed3d5d8083f0ad6b8dbc782d3b8e23911c3
1 ! RUN: %python %S/test_symbols.py %s %flang_fc1
2 ! Explicit and implicit entities in blocks
4 !DEF: /s1 (Subroutine) Subprogram
5 subroutine s1
6 !DEF: /s1/x ObjectEntity INTEGER(4)
7 integer x
8 block
9 !DEF: /s1/BlockConstruct1/y ObjectEntity INTEGER(4)
10 integer y
11 !REF: /s1/x
12 x = 1
13 !REF: /s1/BlockConstruct1/y
14 y = 2.0
15 end block
16 block
17 !DEF: /s1/BlockConstruct2/y ObjectEntity REAL(4)
18 real y
19 !REF: /s1/BlockConstruct2/y
20 y = 3.0
21 end block
22 end subroutine
24 !DEF: /s2 (Subroutine) Subprogram
25 subroutine s2
26 implicit integer(w-x)
27 block
28 !DEF: /s2/x (Implicit) ObjectEntity INTEGER(4)
29 x = 1
30 !DEF: /s2/y (Implicit) ObjectEntity REAL(4)
31 y = 2
32 end block
33 contains
34 !DEF: /s2/s (Subroutine) Subprogram
35 subroutine s
36 !DEF: /s2/s/x (Implicit) HostAssoc INTEGER(4)
37 x = 1
38 !DEF: /s2/s/w (Implicit) ObjectEntity INTEGER(4)
39 w = 1
40 end subroutine
41 end subroutine
43 !DEF: /s3 (Subroutine) Subprogram
44 subroutine s3
45 !DEF: /s3/j ObjectEntity INTEGER(8)
46 integer(kind=8) j
47 block
48 !DEF: /s3/BlockConstruct1/t DerivedType
49 type :: t
50 !DEF: /s3/BlockConstruct1/t/x ObjectEntity REAL(4)
51 !DEF: /s3/BlockConstruct1/t/ImpliedDos1/i (Implicit) ObjectEntity INTEGER(4)
52 real :: x(10) = [(i, i=1,10)]
53 !DEF: /s3/BlockConstruct1/t/y ObjectEntity REAL(4)
54 !DEF: /s3/BlockConstruct1/t/ImpliedDos2/j ObjectEntity INTEGER(8)
55 real :: y(10) = [(j, j=1,10)]
56 end type
57 end block
58 end subroutine
60 !DEF: /s4 (Subroutine) Subprogram
61 subroutine s4
62 implicit integer(x)
63 interface
64 !DEF: /s4/s EXTERNAL (Subroutine) Subprogram
65 !DEF: /s4/s/x (Implicit) ObjectEntity REAL(4)
66 !DEF: /s4/s/y (Implicit) ObjectEntity INTEGER(4)
67 subroutine s (x, y)
68 implicit integer(y)
69 end subroutine
70 end interface
71 end subroutine
73 !DEF: /s5 (Subroutine) Subprogram
74 subroutine s5
75 block
76 !DEF: /s5/BlockConstruct1/x (Implicit) ObjectEntity REAL(4)
77 dimension :: x(2)
78 block
79 !DEF: /s5/BlockConstruct1/BlockConstruct1/x (Implicit) ObjectEntity REAL(4)
80 dimension :: x(3)
81 end block
82 end block
83 !DEF: /s5/x (Implicit) ObjectEntity REAL(4)
84 x = 1.0
85 end subroutine
87 !DEF: /s6 (Subroutine) Subprogram
88 subroutine s6
89 !DEF: /s6/i ObjectEntity INTEGER(4)
90 !DEF: /s6/j ObjectEntity INTEGER(4)
91 !DEF: /s6/k ObjectEntity INTEGER(4)
92 integer i, j, k
93 block
94 !DEF: /s6/BlockConstruct1/i ASYNCHRONOUS, VOLATILE HostAssoc INTEGER(4)
95 volatile :: i
96 !DEF: /s6/BlockConstruct1/j ASYNCHRONOUS HostAssoc INTEGER(4)
97 asynchronous :: j
98 !REF: /s6/BlockConstruct1/i
99 asynchronous :: i
100 !DEF: /s6/BlockConstruct1/k TARGET (Implicit) ObjectEntity INTEGER(4)
101 target :: k
102 end block
103 end subroutine
105 !DEF: /m7 Module
106 module m7
107 !DEF: /m7/i PUBLIC ObjectEntity INTEGER(4)
108 !DEF: /m7/j PUBLIC ObjectEntity INTEGER(4)
109 integer i, j
110 end module
111 !DEF: /s7 (Subroutine) Subprogram
112 subroutine s7
113 !REF: /m7
114 use :: m7
115 !DEF: /s7/j VOLATILE Use INTEGER(4)
116 volatile :: j
117 end subroutine