gcc/testsuite/gcc.c-torture/execute/990404-1.c
raw| 1 | void abort (void); |
| 2 | void exit (int); |
| 3 | |
| 4 | int x[10] = { 0,1,2,3,4,5,6,7,8,9}; |
| 5 | |
| 6 | int |
| 7 | main() |
| 8 | { |
| 9 | int niterations = 0, i; |
| 10 | |
| 11 | for (;;) { |
| 12 | int i, mi, max; |
| 13 | max = 0; |
| 14 | for (i = 0; i < 10 ; i++) { |
| 15 | if (x[i] > max) { |
| 16 | max = x[i]; |
| 17 | mi = i; |
| 18 | } |
| 19 | } |
| 20 | if (max == 0) |
| 21 | break; |
| 22 | x[mi] = 0; |
| 23 | niterations++; |
| 24 | if (niterations > 10) |
| 25 | abort (); |
| 26 | } |
| 27 | |
| 28 | exit (0); |
| 29 | } |