gcc/testsuite/gcc.dg/torture/pr89505.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | struct S { int i; void *p; int j; }; |
| 4 | int a; |
| 5 | int __attribute__((noinline)) |
| 6 | foo (struct S * __restrict p, int q) |
| 7 | { |
| 8 | int *x = &p->j; |
| 9 | if (q) |
| 10 | x = &a; |
| 11 | p->j = 1; |
| 12 | *x = 2; |
| 13 | return p->j; |
| 14 | } |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | struct S s; |
| 19 | if (foo (&s, 0) != 2) |
| 20 | __builtin_abort (); |
| 21 | return 0; |
| 22 | } |