From 41bfbbb68a5501a954e7cb1cacfda26554a6194d Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 19 Nov 2015 15:12:35 +0000 Subject: [PATCH] re PR tree-optimization/68431 (Regression in GCC-6.0.0's optimizer) PR tree-optimization/68431 * tree-vrp.c (extract_range_from_binary_expr_1): Fix condition. * gcc.dg/tree-ssa/pr68431.c: New test. From-SVN: r230608 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr68431.c | 16 ++++++++++++++++ gcc/tree-vrp.c | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr68431.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1cd26979066..4f4b654695c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-11-19 Marek Polacek + + PR tree-optimization/68431 + * tree-vrp.c (extract_range_from_binary_expr_1): Fix condition. + 2015-11-19 Nathan Sidwell * config/nvptx/nvptx.md (atomic_compare_and_swap_1, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 319d1f3a2d3..7b6565914e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-19 Marek Polacek + + PR tree-optimization/68431 + * gcc.dg/tree-ssa/pr68431.c: New test. + 2015-11-19 Jakub Jelinek PR rtl-optimization/68376 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c b/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c new file mode 100644 index 00000000000..3bd3843ed34 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/68431 */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + +unsigned int x = 1; +int +main (void) +{ + long long int a = -2LL; + int t = 1 <= (a / x); + if (t != 0) + __builtin_abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate .*to 0" 1 "vrp1" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index e67048e9045..736082b9ac2 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2975,7 +2975,7 @@ extract_range_from_binary_expr_1 (value_range *vr, if (vr1.type == VR_RANGE && !symbolic_range_p (&vr0) && !symbolic_range_p (&vr1) - && !compare_values (vr1.min, zero)) + && compare_values (vr1.min, zero) != 0) max = int_const_binop (code, vr0.max, vr1.min); else max = zero; -- 2.30.2