gcc/testsuite/gcc.dg/tree-ssa/pr22230.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O1 -ftree-vrp" } */ |
| 3 | |
| 4 | /* PR tree-optimization/22230 |
| 5 | |
| 6 | The meet of the ranges in "i*i" was not computed correctly, leading |
| 7 | gcc to believe that a was equal to 0 after the loop. */ |
| 8 | |
| 9 | extern void abort (void) __attribute__((noreturn)); |
| 10 | |
| 11 | int main (void) |
| 12 | { |
| 13 | long a, i; |
| 14 | |
| 15 | for (i = 0; i < 5; i++) |
| 16 | a = i * i; |
| 17 | if (a != 16) |
| 18 | abort (); |
| 19 | return 0; |
| 20 | } |
| 21 |