Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr119085.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O1" } */
3
4 struct with_hole {
5 int x;
6 long y;
7 };
8 struct without_hole {
9 int x;
10 int y;
11 };
12 union u {
13 struct with_hole with_hole;
14 struct without_hole without_hole;
15 };
16
17 void __attribute__((noinline))
18 test (union u *up, union u u)
19 {
20 union u u2;
21 volatile int f = 0;
22 u2 = u;
23 if (f)
24 u2.with_hole = u.with_hole;
25 *up = u2;
26 }
27
28 int main(void)
29 {
30 union u u;
31 union u u2;
32 u2.without_hole.y = -1;
33 test (&u, u2);
34 if (u.without_hole.y != -1)
35 __builtin_abort ();
36 return 0;
37 }