OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 990326-1.c
1 struct a {
2         char a, b;
3         short c;
4 };
5
6 int
7 a1()
8 {
9         static struct a x = { 1, 2, ~1 }, y = { 65, 2, ~2 };
10
11         return (x.a == (y.a & ~64) && x.b == y.b);
12 }
13
14 int
15 a2()
16 {
17         static struct a x = { 1, 66, ~1 }, y = { 1, 2, ~2 };
18
19         return (x.a == y.a && (x.b & ~64) == y.b);
20 }
21
22 int
23 a3()
24 {
25         static struct a x = { 9, 66, ~1 }, y = { 33, 18, ~2 };
26
27         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
28 }
29
30 struct b {
31         int c;
32         short b, a;
33 };
34
35 int
36 b1()
37 {
38         static struct b x = { ~1, 2, 1 }, y = { ~2, 2, 65 };
39
40         return (x.a == (y.a & ~64) && x.b == y.b);
41 }
42
43 int
44 b2()
45 {
46         static struct b x = { ~1, 66, 1 }, y = { ~2, 2, 1 };
47
48         return (x.a == y.a && (x.b & ~64) == y.b);
49 }
50
51 int
52 b3()
53 {
54         static struct b x = { ~1, 66, 9 }, y = { ~2, 18, 33 };
55
56         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
57 }
58
59 struct c {
60         unsigned int c:4, b:14, a:14;
61 } __attribute__ ((aligned));
62
63 int
64 c1()
65 {
66         static struct c x = { ~1, 2, 1 }, y = { ~2, 2, 65 };
67
68         return (x.a == (y.a & ~64) && x.b == y.b);
69 }
70
71 int
72 c2()
73 {
74         static struct c x = { ~1, 66, 1 }, y = { ~2, 2, 1 };
75
76         return (x.a == y.a && (x.b & ~64) == y.b);
77 }
78
79 int
80 c3()
81 {
82         static struct c x = { ~1, 66, 9 }, y = { ~2, 18, 33 };
83
84         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
85 }
86
87 struct d {
88         unsigned int a:14, b:14, c:4;
89 } __attribute__ ((aligned));
90
91 int
92 d1()
93 {
94         static struct d x = { 1, 2, ~1 }, y = { 65, 2, ~2 };
95
96         return (x.a == (y.a & ~64) && x.b == y.b);
97 }
98
99 int
100 d2()
101 {
102         static struct d x = { 1, 66, ~1 }, y = { 1, 2, ~2 };
103
104         return (x.a == y.a && (x.b & ~64) == y.b);
105 }
106
107 int
108 d3()
109 {
110         static struct d x = { 9, 66, ~1 }, y = { 33, 18, ~2 };
111
112         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
113 }
114
115 struct e {
116         int c:4, b:14, a:14;
117 } __attribute__ ((aligned));
118
119 int
120 e1()
121 {
122         static struct e x = { ~1, -2, -65 }, y = { ~2, -2, -1 };
123
124         return (x.a == (y.a & ~64) && x.b == y.b);
125 }
126
127 int
128 e2()
129 {
130         static struct e x = { ~1, -2, -1 }, y = { ~2, -66, -1 };
131
132         return (x.a == y.a && (x.b & ~64) == y.b);
133 }
134
135 int
136 e3()
137 {
138         static struct e x = { ~1, -18, -33 }, y = { ~2, -66, -9 };
139
140         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
141 }
142
143 int
144 e4()
145 {
146         static struct e x = { -1, -1, 0 };
147
148         return x.a == 0 && x.b & 0x2000;
149 }
150
151 struct f {
152         int a:14, b:14, c:4;
153 } __attribute__ ((aligned));
154
155 int
156 f1()
157 {
158         static struct f x = { -65, -2, ~1 }, y = { -1, -2, ~2 };
159
160         return (x.a == (y.a & ~64) && x.b == y.b);
161 }
162
163 int
164 f2()
165 {
166         static struct f x = { -1, -2, ~1 }, y = { -1, -66, ~2 };
167
168         return (x.a == y.a && (x.b & ~64) == y.b);
169 }
170
171 int
172 f3()
173 {
174         static struct f x = { -33, -18, ~1 }, y = { -9, -66, ~2 };
175
176         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
177 }
178
179 int
180 f4()
181 {
182         static struct f x = { 0, -1, -1 };
183
184         return x.a == 0 && x.b & 0x2000;
185 }
186
187 struct gx {
188         int c:4, b:14, a:14;
189 } __attribute__ ((aligned));
190 struct gy {
191         int b:14, a:14, c:4;
192 } __attribute__ ((aligned));
193
194 int
195 g1()
196 {
197         static struct gx x = { ~1, -2, -65 };
198         static struct gy y = { -2, -1, ~2 };
199
200         return (x.a == (y.a & ~64) && x.b == y.b);
201 }
202
203 int
204 g2()
205 {
206         static struct gx x = { ~1, -2, -1 };
207         static struct gy y = { -66, -1, ~2 };
208
209         return (x.a == y.a && (x.b & ~64) == y.b);
210 }
211
212 int
213 g3()
214 {
215         static struct gx x = { ~1, -18, -33 };
216         static struct gy y = { -66, -9, ~2 };
217
218         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
219 }
220
221 int
222 g4()
223 {
224         static struct gx x = { ~1, 0x0020, 0x0010 };
225         static struct gy y = { 0x0200, 0x0100, ~2 };
226
227         return ((x.a & 0x00f0) == (y.a & 0x0f00) &&
228                 (x.b & 0x00f0) == (y.b & 0x0f00));
229 }
230
231 int
232 g5()
233 {
234         static struct gx x = { ~1, 0x0200, 0x0100 };
235         static struct gy y = { 0x0020, 0x0010, ~2 };
236
237         return ((x.a & 0x0f00) == (y.a & 0x00f0) &&
238                 (x.b & 0x0f00) == (y.b & 0x00f0));
239 }
240
241 int
242 g6()
243 {
244         static struct gx x = { ~1, 0xfe20, 0xfd10 };
245         static struct gy y = { 0xc22f, 0xc11f, ~2 };
246
247         return ((x.a & 0x03ff) == (y.a & 0x3ff0) &&
248                 (x.b & 0x03ff) == (y.b & 0x3ff0));
249 }
250
251 int
252 g7()
253 {
254         static struct gx x = { ~1, 0xc22f, 0xc11f };
255         static struct gy y = { 0xfe20, 0xfd10, ~2 };
256
257         return ((x.a & 0x3ff0) == (y.a & 0x03ff) &&
258                 (x.b & 0x3ff0) == (y.b & 0x03ff));
259 }
260
261 struct hx {
262         int a:14, b:14, c:4;
263 } __attribute__ ((aligned));
264 struct hy {
265         int c:4, a:14, b:14;
266 } __attribute__ ((aligned));
267
268 int
269 h1()
270 {
271         static struct hx x = { -65, -2, ~1 };
272         static struct hy y = { ~2, -1, -2 };
273
274         return (x.a == (y.a & ~64) && x.b == y.b);
275 }
276
277 int
278 h2()
279 {
280         static struct hx x = { -1, -2, ~1 };
281         static struct hy y = { ~2, -1, -66 };
282
283         return (x.a == y.a && (x.b & ~64) == y.b);
284 }
285
286 int
287 h3()
288 {
289         static struct hx x = { -33, -18, ~1 };
290         static struct hy y = { ~2, -9, -66 };
291
292         return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
293 }
294
295 int
296 h4()
297 {
298         static struct hx x = { 0x0010, 0x0020, ~1 };
299         static struct hy y = { ~2, 0x0100, 0x0200 };
300
301         return ((x.a & 0x00f0) == (y.a & 0x0f00) &&
302                 (x.b & 0x00f0) == (y.b & 0x0f00));
303 }
304
305 int
306 h5()
307 {
308         static struct hx x = { 0x0100, 0x0200, ~1 };
309         static struct hy y = { ~2, 0x0010, 0x0020 };
310
311         return ((x.a & 0x0f00) == (y.a & 0x00f0) &&
312                 (x.b & 0x0f00) == (y.b & 0x00f0));
313 }
314
315 int
316 h6()
317 {
318         static struct hx x = { 0xfd10, 0xfe20, ~1 };
319         static struct hy y = { ~2, 0xc11f, 0xc22f };
320
321         return ((x.a & 0x03ff) == (y.a & 0x3ff0) &&
322                 (x.b & 0x03ff) == (y.b & 0x3ff0));
323 }
324
325 int
326 h7()
327 {
328         static struct hx x = { 0xc11f, 0xc22f, ~1 };
329         static struct hy y = { ~2, 0xfd10, 0xfe20 };
330
331         return ((x.a & 0x3ff0) == (y.a & 0x03ff) &&
332                 (x.b & 0x3ff0) == (y.b & 0x03ff));
333 }
334
335 int
336 main()
337 {
338   if (!a1 ())
339     abort ();
340   if (!a2 ())
341     abort ();
342   if (!a3 ())
343     abort ();
344   if (!b1 ())
345     abort ();
346   if (!b2 ())
347     abort ();
348   if (!b3 ())
349     abort ();
350   if (!c1 ())
351     abort ();
352   if (!c2 ())
353     abort ();
354   if (!c3 ())
355     abort ();
356   if (!d1 ())
357     abort ();
358   if (!d2 ())
359     abort ();
360   if (!d3 ())
361     abort ();
362   if (!e1 ())
363     abort ();
364   if (!e2 ())
365     abort ();
366   if (!e3 ())
367     abort ();
368   if (!e4 ())
369     abort ();
370   if (!f1 ())
371     abort ();
372   if (!f2 ())
373     abort ();
374   if (!f3 ())
375     abort ();
376   if (!f4 ())
377     abort ();
378   if (!g1 ())
379     abort ();
380   if (!g2 ())
381     abort ();
382   if (!g3 ())
383     abort ();
384   if (g4 ())
385     abort ();
386   if (g5 ())
387     abort ();
388   if (!g6 ())
389     abort ();
390   if (!g7 ())
391     abort ();
392   if (!h1 ())
393     abort ();
394   if (!h2 ())
395     abort ();
396   if (!h3 ())
397     abort ();
398   if (h4 ())
399     abort ();
400   if (h5 ())
401     abort ();
402   if (!h6 ())
403     abort ();
404   if (!h7 ())
405     abort ();
406   exit (0);
407 }