re PR tree-optimization/68431 (Regression in GCC-6.0.0's optimizer)
authorMarek Polacek <polacek@redhat.com>
Thu, 19 Nov 2015 15:12:35 +0000 (15:12 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 19 Nov 2015 15:12:35 +0000 (15:12 +0000)
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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr68431.c [new file with mode: 0644]
gcc/tree-vrp.c

index 1cd26979066c7dc1bd6f4b5989827561deccfdc9..4f4b654695c011adbaf14a9eb4bd2fa7bfb30549 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-19  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/68431
+       * tree-vrp.c (extract_range_from_binary_expr_1): Fix condition.
+
 2015-11-19  Nathan Sidwell  <nathanacm.org>
 
        * config/nvptx/nvptx.md (atomic_compare_and_swap<mode>_1,
index 319d1f3a2d3eecb45d08cb352bda85de86757df8..7b6565914e446c9fbb64d7810f811e8576ed1fa8 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-19  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/68431
+       * gcc.dg/tree-ssa/pr68431.c: New test.
+
 2015-11-19  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..3bd3843
--- /dev/null
@@ -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" } } */
index e67048e904599747aaaae1b07f95fb94f953f8a9..736082b9ac21e3f3bdbfef47a517091419a44d63 100644 (file)
@@ -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;