gcc/testsuite/gcc.dg/tree-ssa/pr22018.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options -O2 } */ |
| 3 | |
| 4 | void abort (void); |
| 5 | void g(int); |
| 6 | void f(int l) |
| 7 | { |
| 8 | unsigned i; |
| 9 | for (i = 0; i < l; i++) |
| 10 | { |
| 11 | int y = i; |
| 12 | /* VRP was wrongfully computing z's range to be [0, 0] instead |
| 13 | of [-INF, 0]. */ |
| 14 | int z = y*-32; |
| 15 | g(z); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | void g(int i) |
| 20 | { |
| 21 | static int x = 0; |
| 22 | if (i == 0) |
| 23 | x ++; |
| 24 | if (x > 1) |
| 25 | abort (); |
| 26 | } |
| 27 | |
| 28 | int main(void) |
| 29 | { |
| 30 | f(3); |
| 31 | return 0; |
| 32 | } |