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)) test1(WAIT_STATUS s)19test1 (WAIT_STATUS s) 20 { 21 if (s.iptr != &status) 22 abort (); 23 } 24 25 void __attribute__((noinline)) test2(WAIT_STATUS s)26test2 (WAIT_STATUS s) 27 { 28 if (s.uptr != &wstatus) 29 abort (); 30 } 31 main()32int main() 33 { 34 test1 (&status); 35 test2 (&wstatus); 36 return 0; 37 } 38