I was notifed I broke proper handling of undefined overflow in multiplicative ops handling. The following resurrects previous behavior (and adds a testcase).
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2017-08-17 Richard Biener <rguent...@suse.de> * tree-vrp.c (vrp_int_const_binop): Do not set *overflow_p to true when overflow is undefined and we saturated the result. * gcc.dg/tree-ssa/vrp117.c: New testcase. Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c (revision 251084) +++ gcc/tree-vrp.c (working copy) @@ -1614,6 +1614,8 @@ vrp_int_const_binop (enum tree_code code signop sign = TYPE_SIGN (TREE_TYPE (val1)); wide_int res; + *overflow_p = false; + switch (code) { case RSHIFT_EXPR: @@ -1685,8 +1687,6 @@ vrp_int_const_binop (enum tree_code code gcc_unreachable (); } - *overflow_p = overflow; - if (overflow && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (val1))) { @@ -1730,6 +1730,8 @@ vrp_int_const_binop (enum tree_code code TYPE_SIGN (TREE_TYPE (val1))); } + *overflow_p = overflow; + return res; } Index: gcc/testsuite/gcc.dg/tree-ssa/vrp117.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/vrp117.c (nonexistent) +++ gcc/testsuite/gcc.dg/tree-ssa/vrp117.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +void link_error (void); + +void foo (int i) +{ + if (i > __INT_MAX__ - 10) + { + int j = i * 10; + if (j < i) + link_error (); + } +} + +/* { dg-final { scan-tree-dump-not "link_error" "evrp" } } */