[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / symbol15.f90
blob318819e224cd8c26e722218521ae4591939a6c77
1 ! RUN: %python %S/test_symbols.py %s %flang_fc1
2 ! Forward references in pointer initializers and TBP bindings.
4 !DEF: /m Module
5 module m
6 implicit none
7 abstract interface
8 !DEF: /m/iface ABSTRACT, PUBLIC (Subroutine) Subprogram
9 subroutine iface
10 end subroutine
11 end interface
12 !DEF: /m/op1 POINTER, PUBLIC ObjectEntity REAL(4)
13 real, pointer :: op1
14 !DEF: /m/op2 POINTER, PUBLIC ObjectEntity REAL(4)
15 !DEF: /m/null INTRINSIC, PUBLIC, PURE (Function) ProcEntity
16 real, pointer :: op2 => null()
17 !DEF: /m/op3 POINTER, PUBLIC (InDataStmt) ObjectEntity REAL(4)
18 !DEF: /m/x PUBLIC, TARGET ObjectEntity REAL(4)
19 real, pointer :: op3 => x
20 !DEF: /m/op4 POINTER, PUBLIC (InDataStmt) ObjectEntity REAL(4)
21 !DEF: /m/y PUBLIC, TARGET ObjectEntity REAL(4)
22 real, pointer :: op4 => y(1)
23 !REF: /m/iface
24 !DEF: /m/pp1 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
25 procedure(iface), pointer :: pp1
26 !REF: /m/iface
27 !DEF: /m/pp2 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
28 !REF: /m/null
29 procedure(iface), pointer :: pp2 => null()
30 !REF: /m/iface
31 !DEF: /m/pp3 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
32 !DEF: /m/ext1 EXTERNAL, PUBLIC (Subroutine) ProcEntity
33 procedure(iface), pointer :: pp3 => ext1
34 !REF: /m/iface
35 !DEF: /m/pp4 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
36 !DEF: /m/ext2 EXTERNAL, PUBLIC (Subroutine) Subprogram
37 procedure(iface), pointer :: pp4 => ext2
38 !REF: /m/iface
39 !DEF: /m/pp5 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
40 !DEF: /m/ext3 EXTERNAL, PUBLIC (Subroutine) ProcEntity
41 procedure(iface), pointer :: pp5 => ext3
42 !REF: /m/iface
43 !DEF: /m/pp6 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
44 !DEF: /m/modproc1 PUBLIC (Subroutine) Subprogram
45 procedure(iface), pointer :: pp6 => modproc1
46 !DEF: /m/t1 PUBLIC DerivedType
47 type :: t1
48 !DEF: /m/t1/opc1 POINTER ObjectEntity REAL(4)
49 real, pointer :: opc1
50 !DEF: /m/t1/opc2 POINTER ObjectEntity REAL(4)
51 !REF: /m/null
52 real, pointer :: opc2 => null()
53 !DEF: /m/t1/opc3 POINTER (InDataStmt) ObjectEntity REAL(4)
54 !REF: /m/x
55 real, pointer :: opc3 => x
56 !DEF: /m/t1/opc4 POINTER (InDataStmt) ObjectEntity REAL(4)
57 !REF: /m/y
58 real, pointer :: opc4 => y(1)
59 !REF: /m/iface
60 !DEF: /m/t1/ppc1 NOPASS, POINTER (Subroutine) ProcEntity
61 procedure(iface), nopass, pointer :: ppc1
62 !REF: /m/iface
63 !DEF: /m/t1/ppc2 NOPASS, POINTER (Subroutine) ProcEntity
64 !REF: /m/null
65 procedure(iface), nopass, pointer :: ppc2 => null()
66 !REF: /m/iface
67 !DEF: /m/t1/ppc3 NOPASS, POINTER (Subroutine) ProcEntity
68 !REF: /m/ext1
69 procedure(iface), nopass, pointer :: ppc3 => ext1
70 !REF: /m/iface
71 !DEF: /m/t1/ppc4 NOPASS, POINTER (Subroutine) ProcEntity
72 !REF: /m/ext2
73 procedure(iface), nopass, pointer :: ppc4 => ext2
74 !REF: /m/iface
75 !DEF: /m/t1/ppc5 NOPASS, POINTER (Subroutine) ProcEntity
76 !REF: /m/ext3
77 procedure(iface), nopass, pointer :: ppc5 => ext3
78 !REF: /m/iface
79 !DEF: /m/t1/ppc6 NOPASS, POINTER (Subroutine) ProcEntity
80 !REF: /m/modproc1
81 procedure(iface), nopass, pointer :: ppc6 => modproc1
82 contains
83 !DEF: /m/t1/b2 NOPASS ProcBinding
84 !REF: /m/ext2
85 procedure, nopass :: b2 => ext2
86 !DEF: /m/t1/b3 NOPASS ProcBinding
87 !REF: /m/ext3
88 procedure, nopass :: b3 => ext3
89 !DEF: /m/t1/b4 NOPASS ProcBinding
90 !REF: /m/modproc1
91 procedure, nopass :: b4 => modproc1
92 end type
93 !DEF: /m/pdt1 PUBLIC DerivedType
94 !DEF: /m/pdt1/k TypeParam INTEGER(4)
95 type :: pdt1(k)
96 !REF: /m/pdt1/k
97 integer, kind :: k
98 !DEF: /m/pdt1/opc1 POINTER ObjectEntity REAL(4)
99 real, pointer :: opc1
100 !DEF: /m/pdt1/opc2 POINTER ObjectEntity REAL(4)
101 !REF: /m/null
102 real, pointer :: opc2 => null()
103 !DEF: /m/pdt1/opc3 POINTER (InDataStmt) ObjectEntity REAL(4)
104 !REF: /m/x
105 real, pointer :: opc3 => x
106 !DEF: /m/pdt1/opc4 POINTER (InDataStmt) ObjectEntity REAL(4)
107 !REF: /m/y
108 !REF: /m/pdt1/k
109 real, pointer :: opc4 => y(k)
110 !REF: /m/iface
111 !DEF: /m/pdt1/ppc1 NOPASS, POINTER (Subroutine) ProcEntity
112 procedure(iface), nopass, pointer :: ppc1
113 !REF: /m/iface
114 !DEF: /m/pdt1/ppc2 NOPASS, POINTER (Subroutine) ProcEntity
115 !REF: /m/null
116 procedure(iface), nopass, pointer :: ppc2 => null()
117 !REF: /m/iface
118 !DEF: /m/pdt1/ppc3 NOPASS, POINTER (Subroutine) ProcEntity
119 !REF: /m/ext1
120 procedure(iface), nopass, pointer :: ppc3 => ext1
121 !REF: /m/iface
122 !DEF: /m/pdt1/ppc4 NOPASS, POINTER (Subroutine) ProcEntity
123 !REF: /m/ext2
124 procedure(iface), nopass, pointer :: ppc4 => ext2
125 !REF: /m/iface
126 !DEF: /m/pdt1/ppc5 NOPASS, POINTER (Subroutine) ProcEntity
127 !REF: /m/ext3
128 procedure(iface), nopass, pointer :: ppc5 => ext3
129 !REF: /m/iface
130 !DEF: /m/pdt1/ppc6 NOPASS, POINTER (Subroutine) ProcEntity
131 !REF: /m/modproc1
132 procedure(iface), nopass, pointer :: ppc6 => modproc1
133 contains
134 !DEF: /m/pdt1/b2 NOPASS ProcBinding
135 !REF: /m/ext2
136 procedure, nopass :: b2 => ext2
137 !DEF: /m/pdt1/b3 NOPASS ProcBinding
138 !REF: /m/ext3
139 procedure, nopass :: b3 => ext3
140 !DEF: /m/pdt1/b4 NOPASS ProcBinding
141 !REF: /m/modproc1
142 procedure, nopass :: b4 => modproc1
143 end type
144 !REF: /m/t1
145 !DEF: /m/t1x PUBLIC ObjectEntity TYPE(t1)
146 type(t1) :: t1x
147 !REF: /m/pdt1
148 !DEF: /m/pdt1x PUBLIC ObjectEntity TYPE(pdt1(k=1_4))
149 type(pdt1(1)) :: pdt1x
150 !REF: /m/x
151 !REF: /m/y
152 real, target :: x, y(2)
153 !REF: /m/ext1
154 external :: ext1
155 !REF: /m/iface
156 !REF: /m/ext3
157 procedure(iface) :: ext3
158 interface
159 !REF: /m/ext2
160 subroutine ext2
161 end subroutine
162 end interface
163 !DEF: /m/op10 POINTER, PUBLIC(InDataStmt) ObjectEntity REAL(4)
164 !REF: /m/x
165 real, pointer :: op10 => x
166 !DEF: /m/op11 POINTER, PUBLIC(InDataStmt) ObjectEntity REAL(4)
167 !REF: /m/y
168 real, pointer :: op11 => y(1)
169 !REF: /m/iface
170 !DEF: /m/pp10 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
171 !REF: /m/ext1
172 procedure(iface), pointer :: pp10 => ext1
173 !REF: /m/iface
174 !DEF: /m/pp11 EXTERNAL, POINTER, PUBLIC (Subroutine) ProcEntity
175 !REF: /m/ext2
176 procedure(iface), pointer :: pp11 => ext2
177 !DEF: /m/t2 PUBLIC DerivedType
178 type :: t2
179 !DEF: /m/t2/opc10 POINTER (InDataStmt) ObjectEntity REAL(4)
180 !REF: /m/x
181 real, pointer :: opc10 => x
182 !DEF: /m/t2/opc11 POINTER (InDataStmt) ObjectEntity REAL(4)
183 !REF: /m/y
184 real, pointer :: opc11 => y(1)
185 !REF: /m/iface
186 !DEF: /m/t2/ppc10 NOPASS, POINTER (Subroutine) ProcEntity
187 !REF: /m/ext1
188 procedure(iface), nopass, pointer :: ppc10 => ext1
189 !REF: /m/iface
190 !DEF: /m/t2/ppc11 NOPASS, POINTER (Subroutine) ProcEntity
191 !REF: /m/ext2
192 procedure(iface), nopass, pointer :: ppc11 => ext2
193 contains
194 !DEF: /m/t2/b10 NOPASS ProcBinding
195 !REF: /m/ext2
196 procedure, nopass :: b10 => ext2
197 !DEF: /m/t2/b11 NOPASS ProcBinding
198 !REF: /m/ext3
199 procedure, nopass :: b11 => ext3
200 end type
201 !DEF: /m/pdt2 PUBLIC DerivedType
202 !DEF: /m/pdt2/k TypeParam INTEGER(4)
203 type :: pdt2(k)
204 !REF: /m/pdt2/k
205 integer, kind :: k
206 !DEF: /m/pdt2/opc10 POINTER (InDataStmt) ObjectEntity REAL(4)
207 !REF: /m/x
208 real, pointer :: opc10 => x
209 !DEF: /m/pdt2/opc11 POINTER (InDataStmt) ObjectEntity REAL(4)
210 !REF: /m/y
211 !REF: /m/pdt2/k
212 real, pointer :: opc11 => y(k)
213 !REF: /m/iface
214 !DEF: /m/pdt2/ppc10 NOPASS, POINTER (Subroutine) ProcEntity
215 !REF: /m/ext1
216 procedure(iface), nopass, pointer :: ppc10 => ext1
217 !REF: /m/iface
218 !DEF: /m/pdt2/ppc11 NOPASS, POINTER (Subroutine) ProcEntity
219 !REF: /m/ext2
220 procedure(iface), nopass, pointer :: ppc11 => ext2
221 contains
222 !DEF: /m/pdt2/b10 NOPASS ProcBinding
223 !REF: /m/ext2
224 procedure, nopass :: b10 => ext2
225 !DEF: /m/pdt2/b11 NOPASS ProcBinding
226 !REF: /m/ext3
227 procedure, nopass :: b11 => ext3
228 end type
229 !REF: /m/t2
230 !DEF: /m/t2x PUBLIC ObjectEntity TYPE(t2)
231 type(t2) :: t2x
232 !REF: /m/pdt2
233 !DEF: /m/pdt2x PUBLIC ObjectEntity TYPE(pdt2(k=1_4))
234 type(pdt2(1)) :: pdt2x
235 contains
236 !REF: /m/modproc1
237 subroutine modproc1
238 end subroutine
239 end module
240 !DEF: /ext1 (Subroutine) Subprogram
241 subroutine ext1
242 end subroutine
243 !DEF: /ext2 (Subroutine) Subprogram
244 subroutine ext2
245 end subroutine
246 !DEF: /ext3 (Subroutine) Subprogram
247 subroutine ext3
248 end subroutine
249 !DEF: /main MainProgram
250 program main
251 !REF: /m
252 use :: m
253 !DEF: /main/pdt1 Use
254 !DEF: /main/pdt1y ObjectEntity TYPE(pdt1(k=2_4))
255 type(pdt1(2)) :: pdt1y
256 !DEF: /main/pdt2 Use
257 !DEF: /main/pdt2y ObjectEntity TYPE(pdt2(k=2_4))
258 type(pdt2(2)) :: pdt2y
259 print *, "compiled"
260 end program