gcc/testsuite/gcc.dg/torture/pr105198.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-additional-options "-fno-tree-pre -fpredictive-commoning" } */ |
| 3 | |
| 4 | static __attribute__ ((noipa)) void |
| 5 | next_set(int *x, int n, int k) |
| 6 | { |
| 7 | int j = k - 1; |
| 8 | int tmp = x[j]++; |
| 9 | while (j > 0) |
| 10 | { |
| 11 | if (x[j] < n - (k - 1 -j)) |
| 12 | break; |
| 13 | j--; |
| 14 | x[j]++; |
| 15 | tmp = x[j]; |
| 16 | } |
| 17 | if (tmp != 2 || j != 1 || x[0] != 0 || x[1] != 2 || x[2] != 5) |
| 18 | __builtin_abort (); |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | int x[3] = {0, 1, 4}; |
| 24 | next_set(x, 5, 3); |
| 25 | return 0; |
| 26 | } |