gcc/testsuite/g++.dg/ipa/pure-const-3.h
raw| 1 | int *ptr; |
| 2 | static int barvar; |
| 3 | static int b(int a); |
| 4 | /* We can not detect A to be const because it may be interposed by unoptimized |
| 5 | body. */ |
| 6 | inline |
| 7 | __attribute__ ((noinline)) |
| 8 | int a(int a) |
| 9 | { |
| 10 | if (a>0) |
| 11 | return b(a-1); |
| 12 | return *ptr == *ptr; |
| 13 | } |
| 14 | inline |
| 15 | __attribute__ ((noinline)) |
| 16 | static int b(int p) |
| 17 | { |
| 18 | if (p<0) |
| 19 | return a(p+1); |
| 20 | return 1; |
| 21 | } |
| 22 | int main() |
| 23 | { |
| 24 | int aa; |
| 25 | ptr = &barvar; |
| 26 | aa=!b(3); |
| 27 | ptr = 0; |
| 28 | return aa; |
| 29 | } |