PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / bitfld-3.c
blob5207bedb8837b23cef9207799e9e6b0544642b73
1 /* Test for bitfield alignment in structs and unions. */
2 /* { dg-do run { target pcc_bitfield_type_matters } } */
3 /* { dg-options "-O2" } */
5 extern void abort (void);
6 extern void exit (int);
8 typedef long la __attribute__((aligned (8)));
10 struct A
12 char a;
13 union UA
15 char x;
16 la y : 6;
17 } b;
18 char c;
19 } a;
21 struct B
23 char a;
24 union UB
26 char x;
27 long y : 6 __attribute__((aligned (8)));
28 } b;
29 char c;
30 } b;
32 struct C
34 char a;
35 struct UC
37 la y : 6;
38 } b;
39 char c;
40 } c;
42 struct D
44 char a;
45 struct UD
47 long y : 6 __attribute__((aligned (8)));
48 } b;
49 char c;
50 } d;
52 int main (void)
54 if (sizeof (a) != sizeof (b))
55 abort ();
56 if (sizeof (a) != sizeof (c))
57 abort ();
58 if (sizeof (a) != sizeof (d))
59 abort ();
60 if ((&a.c - &a.a) != (&b.c - &b.a))
61 abort ();
62 if ((&a.c - &a.a) != (&c.c - &c.a))
63 abort ();
64 if ((&a.c - &a.a) != (&d.c - &d.a))
65 abort ();
66 exit (0);