https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79095
--- Comment #13 from Jeffrey A. Law <law at gcc dot gnu.org> --- Author: law Date: Tue Feb 14 15:54:09 2017 New Revision: 245434 URL: https://gcc.gnu.org/viewcvs?rev=245434&root=gcc&view=rev Log: PR tree-optimization/79095 * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the range ~[0,0] make the resultant range ~[0,0]. (extract_range_from_binary_expr): For MINUS_EXPR with no derived range, if the operands are known to be not equal, then the resulting range is ~[0,0]. (intersect_ranges): If the new range is ~[0,0] and the old range is wide, then prefer ~[0,0]. * tree-vrp.c (overflow_comparison_p_1): New function. (overflow_comparison_p): New function. * tree-vrp.c (register_edge_assert_for_2): Register additional asserts if NAME is used in an overflow test. (vrp_evaluate_conditional_warnv_with_ops): If the ops represent an overflow check that can be expressed as an equality test, then adjust ops to be that equality test. PR tree-optimization/79095 * g++.dg/pr79095-1.C: New test * g++.dg/pr79095-2.C: New test * g++.dg/pr79095-3.C: New test * g++.dg/pr79095-4.C: New test * g++.dg/pr79095-5.C: New test * gcc.c-torture/execute/arith-1.c: Update with more cases. * gcc.dg/tree-ssa/pr79095-1.c: New test. Added: trunk/gcc/testsuite/g++.dg/pr79095-1.C trunk/gcc/testsuite/g++.dg/pr79095-2.C trunk/gcc/testsuite/g++.dg/pr79095-3.C trunk/gcc/testsuite/g++.dg/pr79095-4.C trunk/gcc/testsuite/g++.dg/pr79095-5.C trunk/gcc/testsuite/gcc.dg/tree-ssa/pr79095.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.c-torture/execute/arith-1.c trunk/gcc/tree-vrp.c