gcc/testsuite/gcc.dg/pr20100.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O2" } */ |
| 3 | |
| 4 | int func_pure (void) __attribute__ ((pure)); |
| 5 | void func_other (int); |
| 6 | int global_int; |
| 7 | void abort (); |
| 8 | void func_other(int a) |
| 9 | { |
| 10 | if (a != global_int) |
| 11 | abort (); |
| 12 | global_int++; |
| 13 | } |
| 14 | |
| 15 | int func_pure(void) |
| 16 | { |
| 17 | return global_int; |
| 18 | } |
| 19 | |
| 20 | int |
| 21 | func_loop (int arg) |
| 22 | { |
| 23 | // global_int ++; |
| 24 | while (arg--) |
| 25 | func_other (func_pure ()); |
| 26 | } |
| 27 | |
| 28 | int main(void) |
| 29 | { |
| 30 | func_loop(10); |
| 31 | return 0; |
| 32 | } |