gcc/testsuite/gcc.dg/torture/pr49651.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | extern void abort (void); |
| 4 | |
| 5 | struct X { |
| 6 | int *p; |
| 7 | int *q; |
| 8 | }; |
| 9 | |
| 10 | void __attribute__((noinline, noclone)) |
| 11 | foo (struct X x) { *x.q = 0; } |
| 12 | |
| 13 | volatile int what; |
| 14 | struct X y; |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | int i, j; |
| 19 | struct X x, *p; |
| 20 | x.p = &i; |
| 21 | x.q = &j; |
| 22 | if (what) |
| 23 | p = &y; |
| 24 | else |
| 25 | p = &x; |
| 26 | j = 1; |
| 27 | foo (*p); |
| 28 | if (j != 0) |
| 29 | abort (); |
| 30 | return 0; |
| 31 | } |