gcc/testsuite/gcc.dg/torture/pr67947.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-additional-options "-O3" } */ |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | int a; |
| 7 | int c; |
| 8 | __attribute__((noinline, noclone)) void foo (int x) |
| 9 | { |
| 10 | if (x == 0) |
| 11 | c++; |
| 12 | } |
| 13 | |
| 14 | volatile int t = 1; |
| 15 | |
| 16 | int |
| 17 | main (int argc, char* argv[]) |
| 18 | { |
| 19 | int j, k, b = 0; |
| 20 | if (t == 0) |
| 21 | b = 1; |
| 22 | for (j = 0; j < 3; j++) |
| 23 | for (k = 0; k < 1; k++) |
| 24 | { |
| 25 | foo (0); |
| 26 | if (b) |
| 27 | for (k = -1; a;) |
| 28 | ; |
| 29 | } |
| 30 | if (c != 3) |
| 31 | abort (); |
| 32 | return 0; |
| 33 | } |