Debian Codegraph @

gcc/testsuite/g++.dg/opt/anonunion1.C

raw
1 // PR c++/5748
2 // This testcase ICEd because used flag from the anon union variables
3 // was not propagated back to the anon union itself, causing addressof
4 // not to be replaced with stack slot.
5 // { dg-do compile }
6 // { dg-options "-O2" }
7
8 struct A {
9 A ();
10 ~A ();
11 int foo ();
12 int bar (void *x, int y);
13 };
14
15 int A::foo()
16 {
17 union {
18 int a;
19 int b;
20 };
21
22 if (bar (&a, sizeof (int)) != 32)
23 return 16;
24 return 0;
25 }