gcc/testsuite/gcc.c-torture/execute/20030404-1.c
raw| 1 | /* This exposed a bug in tree-ssa-ccp.c. Since 'j' and 'i' are never |
| 2 | defined, CCP was not traversing the edges out of the if(), which caused |
| 3 | the PHI node for 'k' at the top of the while to only be visited once. |
| 4 | This ended up causing CCP to think that 'k' was the constant '1'. */ |
| 5 | void abort (void); |
| 6 | |
| 7 | int |
| 8 | main(void) |
| 9 | { |
| 10 | int i, j, k; |
| 11 | |
| 12 | k = 0; |
| 13 | while (k < 10) |
| 14 | { |
| 15 | k++; |
| 16 | if (j > i) |
| 17 | j = 5; |
| 18 | else |
| 19 | j =3; |
| 20 | } |
| 21 | |
| 22 | if (k != 10) |
| 23 | abort (); |
| 24 | |
| 25 | return 0; |
| 26 | } |