]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/transparent-union-5.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / transparent-union-5.c
1 /* PR 24255 */
2 /* { dg-do run } */
3 /* { dg-options "-O" } */
4
5 extern void abort (void);
6
7 union wait { int w_status; };
8
9 typedef union
10 {
11 union wait *uptr;
12 int *iptr;
13 } WAIT_STATUS __attribute__ ((__transparent_union__));
14
15 int status;
16 union wait wstatus;
17
18 void __attribute__((noinline))
19 test1 (WAIT_STATUS s)
20 {
21 if (s.iptr != &status)
22 abort ();
23 }
24
25 void __attribute__((noinline))
26 test2 (WAIT_STATUS s)
27 {
28 if (s.uptr != &wstatus)
29 abort ();
30 }
31
32 int main()
33 {
34 test1 (&status);
35 test2 (&wstatus);
36 return 0;
37 }