1 /* { dg-do run { target int32plus } } */
2 /* { dg-options "-O2" } */
3 
4 struct S0
5 {
6   unsigned a : 15;
7   int b;
8   int c;
9 };
10 
11 struct S1
12 {
13   struct S0 s0;
14   int e;
15 };
16 
17 struct Z
18 {
19   char c;
20   int z;
21 } __attribute__((packed));
22 
23 union U
24 {
25   struct S1 s1;
26   struct Z z;
27 };
28 
29 
30 int __attribute__((noinline, noclone))
return_zero(void)31 return_zero (void)
32 {
33   return 0;
34 }
35 
36 volatile union U gu;
37 struct S0 gs;
38 
39 int __attribute__((noinline, noclone))
check_outcome()40 check_outcome ()
41 {
42   if (gs.a != 6
43       || gs.b != 80000)
44     __builtin_abort ();
45 }
46 
47 int
main(int argc,char * argv[])48 main (int argc, char *argv[])
49 {
50   union U u;
51   struct S1 m;
52   struct S0 l;
53 
54   if (return_zero ())
55     u.z.z = 20000;
56   else
57     {
58       u.s1.s0.a = 6;
59       u.s1.s0.b = 80000;
60       u.s1.e = 2;
61 
62       m = u.s1;
63       m.s0.c = 0;
64       l = m.s0;
65       gs = l;
66     }
67 
68   gu = u;
69   check_outcome ();
70   return 0;
71 }
72