1 // { dg-do run } 2 // Bug: g++ crashed on empty initializers for unions. 3 // Bug: gcc and g++ didn't zero unions with empty initializers. 4 // Submitted by J"orn Rennecke <amylaar@cygnus.co.uk> 5 6 extern "C" void exit (int); 7 8 typedef union u 9 { 10 union u *up; 11 void *vp; 12 } u; 13 14 static u v = {}; 15 16 void bar (u); 17 void baz (u); 18 foo()19void foo() 20 { 21 u w = {}; 22 u x = { &v }; 23 baz (x); 24 bar (w); 25 } 26 baz(u w)27void baz (u w) { } 28 bar(u w)29void bar (u w) 30 { 31 if (w.up) 32 exit (1); 33 } 34 main()35int main () 36 { 37 foo (); 38 return 0; 39 } 40