gcc/testsuite/gcc.dg/ipa/ipa-pta-15.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O2 -fipa-pta" } */ |
| 3 | |
| 4 | struct Foo { |
| 5 | int *p; |
| 6 | int *q; |
| 7 | }; |
| 8 | |
| 9 | void __attribute__((noinline)) |
| 10 | bar (int **x) |
| 11 | { |
| 12 | struct Foo *f = (struct Foo *)(x - 1); |
| 13 | *(f->p) = 0; |
| 14 | } |
| 15 | |
| 16 | int foo(void) |
| 17 | { |
| 18 | struct Foo f; |
| 19 | int i = 1, j = 2; |
| 20 | f.p = &i; |
| 21 | f.q = &j; |
| 22 | bar(&f.q); |
| 23 | return i; |
| 24 | } |
| 25 | |
| 26 | extern void abort (void); |
| 27 | int main() |
| 28 | { |
| 29 | if (foo () != 0) |
| 30 | abort (); |
| 31 | return 0; |
| 32 | } |