gcc/testsuite/gcc.c-torture/execute/pr28865.c
raw| 1 | struct A { int a; char b[]; }; |
| 2 | union B { struct A a; char b[sizeof (struct A) + 31]; }; |
| 3 | union B b = { { 1, "123456789012345678901234567890" } }; |
| 4 | union B c = { { 2, "123456789012345678901234567890" } }; |
| 5 | |
| 6 | __attribute__((noinline, noclone)) void |
| 7 | foo (int *x[2]) |
| 8 | { |
| 9 | x[0] = &b.a.a; |
| 10 | x[1] = &c.a.a; |
| 11 | } |
| 12 | |
| 13 | int |
| 14 | main () |
| 15 | { |
| 16 | int *x[2]; |
| 17 | foo (x); |
| 18 | if (*x[0] != 1 || *x[1] != 2) |
| 19 | __builtin_abort (); |
| 20 | return 0; |
| 21 | } |