gcc/testsuite/gcc.dg/tree-ssa/vrp12.c
raw| 1 | /* { dg-do link } */ |
| 2 | /* { dg-options -O2 } */ |
| 3 | |
| 4 | extern void link_error (void); |
| 5 | |
| 6 | int |
| 7 | foo (int i) |
| 8 | { |
| 9 | int x; |
| 10 | |
| 11 | x = i; |
| 12 | if (i < -10) |
| 13 | { |
| 14 | x = __builtin_abs (i); |
| 15 | /* VRP was incorrectly folding this to if (1). */ |
| 16 | if (x < 0) |
| 17 | link_error (); |
| 18 | } |
| 19 | |
| 20 | return x; |
| 21 | } |
| 22 | |
| 23 | int |
| 24 | main() |
| 25 | { |
| 26 | foo (-30); |
| 27 | } |