Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-78.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O3 -fstrict-aliasing" } */
3
4 union U {
5 struct A { int : 2; int x : 8; } a;
6 struct B { int : 6; int x : 8; } b;
7 };
8
9 int __attribute__((noipa))
10 foo (union U *p, union U *q)
11 {
12 p->a.x = 1;
13 q->b.x = 1;
14 return p->a.x;
15 }
16
17 int
18 main()
19 {
20 union U x;
21 if (foo (&x, &x) != x.a.x)
22 __builtin_abort ();
23 return 0;
24 }
25
26 /* We support arbitrary punning through unions when it happens through
27 the union type and thus p == q is valid here. */