re PR tree-optimization/81297 (ICE in get_single_symbol)
authorRichard Biener <rguenther@suse.de>
Tue, 1 Aug 2017 07:04:10 +0000 (07:04 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 1 Aug 2017 07:04:10 +0000 (07:04 +0000)
2017-08-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/81297
* tree-vrp.c (get_single_symbol): Remove assert, instead drop
TREE_OVERFLOW from INTEGER_CSTs.

* gcc.dg/torture/pr81297.c: New testcase.

From-SVN: r250758

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr81297.c [new file with mode: 0644]
gcc/tree-vrp.c

index 3913f1b37fc6dfa7561e065097e18c186e879c38..2e964271d00a049bed0f5e285e3836fd90feeb58 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81297
+       * tree-vrp.c (get_single_symbol): Remove assert, instead drop
+       TREE_OVERFLOW from INTEGER_CSTs.
+
 2017-07-31  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * config/rs6000/rs6000.c (enum rs6000_reg_type): Delete trailing comma.
index 9315835f4d665f1c8eff8fcacc54ab415de55bbd..8ae9ef50c391e9353a147552f51374d49e427fcd 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81297
+       * gcc.dg/torture/pr81297.c: New testcase.
+
 2017-07-31  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/naked-1.c (dg-options): Add -fno-pic.
diff --git a/gcc/testsuite/gcc.dg/torture/pr81297.c b/gcc/testsuite/gcc.dg/torture/pr81297.c
new file mode 100644 (file)
index 0000000..be346c4
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+int
+nf (int gy, int x0)
+{
+  while (gy < 1)
+    ++x0;
+
+  gy += !!gy;
+  if (gy < 0)
+    {
+      x0 += gy;
+      return (x0 > (gy + x0)) ? (1 / 0) : 1; /* { dg-warning "division by zero" } */
+    }
+}
+
index 1f0b6880c457543e8d76e64be1c0800decd996c9..79a29bf0efb7f261a248633fe2c753627ef04939 100644 (file)
@@ -796,7 +796,8 @@ get_single_symbol (tree t, bool *neg, tree *inv)
   if (TREE_CODE (t) != SSA_NAME)
     return NULL_TREE;
 
-  gcc_assert (! inv_ || ! TREE_OVERFLOW_P (inv_));
+  if (inv_ && TREE_OVERFLOW_P (inv_))
+    inv_ = drop_tree_overflow (inv_);
 
   *neg = neg_;
   *inv = inv_;