Reverting merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / transparent-union-5.c
blob47e245e2470c2baf2070de45b850c982542658e5
1 /* PR 24255 */
2 /* { dg-do run } */
3 /* { dg-options "-O" } */
5 extern void abort (void);
7 union wait { int w_status; };
9 typedef union
11 union wait *uptr;
12 int *iptr;
13 } WAIT_STATUS __attribute__ ((__transparent_union__));
15 int status;
16 union wait wstatus;
18 void __attribute__((noinline))
19 test1 (WAIT_STATUS s)
21 if (s.iptr != &status)
22 abort ();
25 void __attribute__((noinline))
26 test2 (WAIT_STATUS s)
28 if (s.uptr != &wstatus)
29 abort ();
32 int main()
34 test1 (&status);
35 test2 (&wstatus);
36 return 0;