[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / modfile17.f90
blob189d8a83de8c561e3a75f9a5265f072c8c403193
1 ! RUN: %python %S/test_modfile.py %s %flang_fc1
2 ! Tests parameterized derived type instantiation with KIND parameters
4 module m
5 type :: capture(k1,k2,k4,k8)
6 integer(kind=1), kind :: k1
7 integer(kind=2), kind :: k2
8 integer(kind=4), kind :: k4
9 integer(kind=8), kind :: k8
10 integer(kind=k1) :: j1
11 integer(kind=k2) :: j2
12 integer(kind=k4) :: j4
13 integer(kind=k8) :: j8
14 end type capture
15 type :: defaulted(n1,n2,n4,n8)
16 integer(kind=1), kind :: n1 = 1
17 integer(kind=2), kind :: n2 = n1 * 2
18 integer(kind=4), kind :: n4 = 2 * n2
19 integer(kind=8), kind :: n8 = 12 - n4
20 type(capture(n1,n2,n4,n8)) :: cap
21 end type defaulted
22 type, extends(defaulted) :: extension(k5)
23 integer(kind=4), kind :: k5 = 4
24 integer(kind=k5) :: j5
25 end type extension
26 type(capture(1,1,1,1)) :: x1111
27 integer(kind=x1111%j1%kind) :: res01_1
28 integer(kind=x1111%j2%kind) :: res02_1
29 integer(kind=x1111%j4%kind) :: res03_1
30 integer(kind=x1111%j8%kind) :: res04_1
31 type(capture(8,8,8,8)) :: x8888
32 integer(kind=x8888%j1%kind) :: res05_8
33 integer(kind=x8888%j2%kind) :: res06_8
34 integer(kind=x8888%j4%kind) :: res07_8
35 integer(kind=x8888%j8%kind) :: res08_8
36 type(capture(2,k8=1,k4=8,k2=4)) :: x2481
37 integer(kind=x2481%j1%kind) :: res09_2
38 integer(kind=x2481%j2%kind) :: res10_4
39 integer(kind=x2481%j4%kind) :: res11_8
40 integer(kind=x2481%j8%kind) :: res12_1
41 type(capture(2,1,k4=8,k8=4)) :: x2184
42 integer(kind=x2184%j1%kind) :: res13_2
43 integer(kind=x2184%j2%kind) :: res14_1
44 integer(kind=x2184%j4%kind) :: res15_8
45 integer(kind=x2184%j8%kind) :: res16_4
46 type(defaulted) :: x1248
47 integer(kind=x1248%cap%j1%kind) :: res17_1
48 integer(kind=x1248%cap%j2%kind) :: res18_2
49 integer(kind=x1248%cap%j4%kind) :: res19_4
50 integer(kind=x1248%cap%j8%kind) :: res20_8
51 type(defaulted(2)) :: x2484
52 integer(kind=x2484%cap%j1%kind) :: res21_2
53 integer(kind=x2484%cap%j2%kind) :: res22_4
54 integer(kind=x2484%cap%j4%kind) :: res23_8
55 integer(kind=x2484%cap%j8%kind) :: res24_4
56 type(defaulted(n8=2)) :: x1242
57 integer(kind=x1242%cap%j1%kind) :: res25_1
58 integer(kind=x1242%cap%j2%kind) :: res26_2
59 integer(kind=x1242%cap%j4%kind) :: res27_4
60 integer(kind=x1242%cap%j8%kind) :: res28_2
61 type(extension(1,1,1,1,1)) :: x11111
62 integer(kind=x11111%defaulted%cap%j1%kind) :: res29_1
63 integer(kind=x11111%cap%j2%kind) :: res30_1
64 integer(kind=x11111%cap%j4%kind) :: res31_1
65 integer(kind=x11111%cap%j8%kind) :: res32_1
66 integer(kind=x11111%j5%kind) :: res33_1
67 type(extension(2,8,4,1,8)) :: x28418
68 integer(kind=x28418%defaulted%cap%j1%kind) :: res34_2
69 integer(kind=x28418%cap%j2%kind) :: res35_8
70 integer(kind=x28418%cap%j4%kind) :: res36_4
71 integer(kind=x28418%cap%j8%kind) :: res37_1
72 integer(kind=x28418%j5%kind) :: res38_8
73 type(extension(8,n8=1,k5=2,n2=4,n4=8)) :: x84812
74 integer(kind=x84812%defaulted%cap%j1%kind) :: res39_8
75 integer(kind=x84812%cap%j2%kind) :: res40_4
76 integer(kind=x84812%cap%j4%kind) :: res41_8
77 integer(kind=x84812%cap%j8%kind) :: res42_1
78 integer(kind=x84812%j5%kind) :: res43_2
79 type(extension(k5=2)) :: x12482
80 integer(kind=x12482%defaulted%cap%j1%kind) :: res44_1
81 integer(kind=x12482%cap%j2%kind) :: res45_2
82 integer(kind=x12482%cap%j4%kind) :: res46_4
83 integer(kind=x12482%cap%j8%kind) :: res47_8
84 integer(kind=x12482%j5%kind) :: res48_2
85 end module
87 !Expect: m.mod
88 !module m
89 !type::capture(k1,k2,k4,k8)
90 !integer(1),kind::k1
91 !integer(2),kind::k2
92 !integer(4),kind::k4
93 !integer(8),kind::k8
94 !integer(int(int(k1,kind=1),kind=8))::j1
95 !integer(int(int(k2,kind=2),kind=8))::j2
96 !integer(int(int(k4,kind=4),kind=8))::j4
97 !integer(k8)::j8
98 !end type
99 !type::defaulted(n1,n2,n4,n8)
100 !integer(1),kind::n1=1_1
101 !integer(2),kind::n2=int(2_4*int(int(n1,kind=1),kind=4),kind=2)
102 !integer(4),kind::n4=2_4*int(int(n2,kind=2),kind=4)
103 !integer(8),kind::n8=int(12_4-int(n4,kind=4),kind=8)
104 !type(capture(k1=int(n1,kind=1),k2=int(n2,kind=2),k4=int(n4,kind=4),k8=n8))::cap
105 !end type
106 !type,extends(defaulted)::extension(k5)
107 !integer(4),kind::k5=4_4
108 !integer(int(int(k5,kind=4),kind=8))::j5
109 !end type
110 !type(capture(k1=1_1,k2=1_2,k4=1_4,k8=1_8))::x1111
111 !integer(1)::res01_1
112 !integer(1)::res02_1
113 !integer(1)::res03_1
114 !integer(1)::res04_1
115 !type(capture(k1=8_1,k2=8_2,k4=8_4,k8=8_8))::x8888
116 !integer(8)::res05_8
117 !integer(8)::res06_8
118 !integer(8)::res07_8
119 !integer(8)::res08_8
120 !type(capture(k1=2_1,k2=4_2,k4=8_4,k8=1_8))::x2481
121 !integer(2)::res09_2
122 !integer(4)::res10_4
123 !integer(8)::res11_8
124 !integer(1)::res12_1
125 !type(capture(k1=2_1,k2=1_2,k4=8_4,k8=4_8))::x2184
126 !integer(2)::res13_2
127 !integer(1)::res14_1
128 !integer(8)::res15_8
129 !integer(4)::res16_4
130 !type(defaulted(n1=1_1,n2=2_2,n4=4_4,n8=8_8))::x1248
131 !integer(1)::res17_1
132 !integer(2)::res18_2
133 !integer(4)::res19_4
134 !integer(8)::res20_8
135 !type(defaulted(n1=2_1,n2=4_2,n4=8_4,n8=4_8))::x2484
136 !integer(2)::res21_2
137 !integer(4)::res22_4
138 !integer(8)::res23_8
139 !integer(4)::res24_4
140 !type(defaulted(n1=1_1,n2=2_2,n4=4_4,n8=2_8))::x1242
141 !integer(1)::res25_1
142 !integer(2)::res26_2
143 !integer(4)::res27_4
144 !integer(2)::res28_2
145 !type(extension(k5=1_4,n1=1_1,n2=1_2,n4=1_4,n8=1_8))::x11111
146 !integer(1)::res29_1
147 !integer(1)::res30_1
148 !integer(1)::res31_1
149 !integer(1)::res32_1
150 !integer(1)::res33_1
151 !type(extension(k5=8_4,n1=2_1,n2=8_2,n4=4_4,n8=1_8))::x28418
152 !integer(2)::res34_2
153 !integer(8)::res35_8
154 !integer(4)::res36_4
155 !integer(1)::res37_1
156 !integer(8)::res38_8
157 !type(extension(k5=2_4,n1=8_1,n2=4_2,n4=8_4,n8=1_8))::x84812
158 !integer(8)::res39_8
159 !integer(4)::res40_4
160 !integer(8)::res41_8
161 !integer(1)::res42_1
162 !integer(2)::res43_2
163 !type(extension(k5=2_4,n1=1_1,n2=2_2,n4=4_4,n8=8_8))::x12482
164 !integer(1)::res44_1
165 !integer(2)::res45_2
166 !integer(4)::res46_4
167 !integer(8)::res47_8
168 !integer(2)::res48_2
169 !end