1struct a {
2	char a, b;
3	short c;
4};
5
6int
7a1()
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
14int
15a2()
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
22int
23a3()
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
30struct b {
31	int c;
32	short b, a;
33};
34
35int
36b1()
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
43int
44b2()
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
51int
52b3()
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
59struct c {
60	unsigned int c:4, b:14, a:14;
61} __attribute__ ((aligned));
62
63int
64c1()
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
71int
72c2()
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
79int
80c3()
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
87struct d {
88	unsigned int a:14, b:14, c:4;
89} __attribute__ ((aligned));
90
91int
92d1()
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
99int
100d2()
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
107int
108d3()
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
115struct e {
116	int c:4, b:14, a:14;
117} __attribute__ ((aligned));
118
119int
120e1()
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
127int
128e2()
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
135int
136e3()
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
143int
144e4()
145{
146	static struct e x = { -1, -1, 0 };
147
148	return x.a == 0 && x.b & 0x2000;
149}
150
151struct f {
152	int a:14, b:14, c:4;
153} __attribute__ ((aligned));
154
155int
156f1()
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
163int
164f2()
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
171int
172f3()
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
179int
180f4()
181{
182	static struct f x = { 0, -1, -1 };
183
184	return x.a == 0 && x.b & 0x2000;
185}
186
187struct gx {
188	int c:4, b:14, a:14;
189} __attribute__ ((aligned));
190struct gy {
191	int b:14, a:14, c:4;
192} __attribute__ ((aligned));
193
194int
195g1()
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
203int
204g2()
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
212int
213g3()
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
221int
222g4()
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
231int
232g5()
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
241int
242g6()
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
251int
252g7()
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
261struct hx {
262	int a:14, b:14, c:4;
263} __attribute__ ((aligned));
264struct hy {
265	int c:4, a:14, b:14;
266} __attribute__ ((aligned));
267
268int
269h1()
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
277int
278h2()
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
286int
287h3()
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
295int
296h4()
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
305int
306h5()
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
315int
316h6()
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
325int
326h7()
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
335int
336main()
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}
408