blob: 140ff6c42436fb597ccea057ec5c885767b1d6df [file] [log] [blame]
Jim Grosbachf7947052012-07-09 18:34:21 +00001// REQUIRES: arm-registered-target
James Molloye45b9b72012-03-12 09:14:10 +00002// RUN: %clang_cc1 -target-abi aapcs -triple armv7-apple-darwin10 %s -verify
3
4#include <stddef.h>
5
6struct t1
7{
8 int foo : 1;
9 char : 0;
10 char bar;
11};
12static int arr1_offset[(offsetof(struct t1, bar) == 1) ? 0 : -1];
13static int arr1_sizeof[(sizeof(struct t1) == 4) ? 0 : -1];
14
15struct t2
16{
17 int foo : 1;
18 short : 0;
19 char bar;
20};
21static int arr2_offset[(offsetof(struct t2, bar) == 2) ? 0 : -1];
22static int arr2_sizeof[(sizeof(struct t2) == 4) ? 0 : -1];
23
24struct t3
25{
26 int foo : 1;
27 int : 0;
28 char bar;
29};
30static int arr3_offset[(offsetof(struct t3, bar) == 4) ? 0 : -1];
31static int arr3_sizeof[(sizeof(struct t3) == 8) ? 0 : -1];
32
33struct t4
34{
35 int foo : 1;
36 long : 0;
37 char bar;
38};
39static int arr4_offset[(offsetof(struct t4, bar) == 4) ? 0 : -1];
40static int arr4_sizeof[(sizeof(struct t4) == 8) ? 0 : -1];
41
42struct t5
43{
44 int foo : 1;
45 long long : 0;
46 char bar;
47};
48static int arr5_offset[(offsetof(struct t5, bar) == 8) ? 0 : -1];
49static int arr5_sizeof[(sizeof(struct t5) == 16) ? 0 : -1];
50
51struct t6
52{
53 int foo : 1;
54 char : 0;
55 char bar : 1;
56 char bar2;
57};
58static int arr6_offset[(offsetof(struct t6, bar2) == 2) ? 0 : -1];
59static int arr6_sizeof[(sizeof(struct t6) == 4) ? 0 : -1];
60
61struct t7
62{
63 int foo : 1;
64 short : 0;
65 char bar1 : 1;
66 char bar2;
67};
68static int arr7_offset[(offsetof(struct t7, bar2) == 3) ? 0 : -1];
69static int arr7_sizeof[(sizeof(struct t7) == 4) ? 0 : -1];
70
71struct t8
72{
73 int foo : 1;
74 int : 0;
75 char bar1 : 1;
76 char bar2;
77};
78static int arr8_offset[(offsetof(struct t8, bar2) == 5) ? 0 : -1];
79static int arr8_sizeof[(sizeof(struct t8) == 8) ? 0 : -1];
80
81struct t9
82{
83 int foo : 1;
84 long : 0;
85 char bar1 : 1;
86 char bar2;
87};
88static int arr9_offset[(offsetof(struct t9, bar2) == 5) ? 0 : -1];
89static int arr9_sizeof[(sizeof(struct t9) == 8) ? 0 : -1];
90
91struct t10
92{
93 int foo : 1;
94 long long : 0;
95 char bar1 : 1;
96 char bar2;
97};
98static int arr10_offset[(offsetof(struct t10, bar2) == 9) ? 0 : -1];
99static int arr10_sizeof[(sizeof(struct t10) == 16) ? 0 : -1];
100
101struct t11
102{
103 int foo : 1;
104 long long : 0;
105 char : 0;
106 char bar1 : 1;
107 char bar2;
108};
109static int arr11_offset[(offsetof(struct t11, bar2) == 9) ? 0 : -1];
110static int arr11_sizeof[(sizeof(struct t11) == 16) ? 0 : -1];
111
112struct t12
113{
114 int foo : 1;
115 char : 0;
116 long long : 0;
117 char : 0;
118 char bar;
119};
120static int arr12_offset[(offsetof(struct t12, bar) == 8) ? 0 : -1];
121static int arr12_sizeof[(sizeof(struct t12) == 16) ? 0 : -1];
122
123struct t13
124{
125 char foo;
126 long : 0;
127 char bar;
128};
129static int arr13_offset[(offsetof(struct t13, bar) == 4) ? 0 : -1];
130static int arr13_sizeof[(sizeof(struct t13) == 8) ? 0 : -1];
131
132struct t14
133{
134 char foo1;
135 int : 0;
136 char foo2 : 1;
137 short foo3 : 16;
138 char : 0;
139 short foo4 : 16;
140 char bar1;
141 int : 0;
142 char bar2;
143};
144static int arr14_bar1_offset[(offsetof(struct t14, bar1) == 10) ? 0 : -1];
145static int arr14_bar2_offset[(offsetof(struct t14, bar2) == 12) ? 0 : -1];
146static int arr14_sizeof[(sizeof(struct t14) == 16) ? 0 : -1];
147
148struct t15
149{
150 char foo;
151 char : 0;
152 int : 0;
153 char bar;
154 long : 0;
155 char : 0;
156};
157static int arr15_offset[(offsetof(struct t15, bar) == 4) ? 0 : -1];
158static int arr15_sizeof[(sizeof(struct t15) == 8) ? 0 : -1];
159
160struct t16
161{
162 long : 0;
163 char bar;
164};
165static int arr16_offset[(offsetof(struct t16, bar) == 0) ? 0 : -1];
166static int arr16_sizeof[(sizeof(struct t16) == 4) ? 0 : -1];
167
168struct t17
169{
170 char foo;
171 long : 0;
172 long : 0;
173 char : 0;
174 char bar;
175};
176static int arr17_offset[(offsetof(struct t17, bar) == 4) ? 0 : -1];
177static int arr17_sizeof[(sizeof(struct t17) == 8) ? 0 : -1];
178
179struct t18
180{
181 long : 0;
182 long : 0;
183 char : 0;
184};
185static int arr18_sizeof[(sizeof(struct t18) == 0) ? 0 : -1];
186
187struct t19
188{
189 char foo1;
190 long foo2 : 1;
191 char : 0;
192 long foo3 : 32;
193 char bar;
194};
195static int arr19_offset[(offsetof(struct t19, bar) == 8) ? 0 : -1];
196static int arr19_sizeof[(sizeof(struct t19) == 12) ? 0 : -1];
197
198struct t20
199{
200 short : 0;
201 int foo : 1;
202 long : 0;
203 char bar;
204};
205static int arr20_offset[(offsetof(struct t20, bar) == 4) ? 0 : -1];
206static int arr20_sizeof[(sizeof(struct t20) == 8) ? 0 : -1];
207
208struct t21
209{
210 short : 0;
211 int foo1 : 1;
212 char : 0;
213 int foo2 : 16;
214 long : 0;
215 char bar1;
216 int bar2;
217 long bar3;
218 char foo3 : 8;
219 char : 0;
220 long : 0;
221 int foo4 : 32;
222 short foo5: 1;
223 long bar4;
224 short foo6: 16;
225 short foo7: 16;
226 short foo8: 16;
227};
228static int arr21_bar1_offset[(offsetof(struct t21, bar1) == 4) ? 0 : -1];
229static int arr21_bar2_offset[(offsetof(struct t21, bar2) == 8) ? 0 : -1];
230static int arr21_bar3_offset[(offsetof(struct t21, bar3) == 12) ? 0 : -1];
231static int arr21_bar4_offset[(offsetof(struct t21, bar4) == 28) ? 0 : -1];
232static int arr21_sizeof[(sizeof(struct t21) == 40) ? 0 : -1];
233
234int main() {
235 return 0;
236}
237