re PR tree-optimization/92203 (ICE in eliminate_stmt, at tree-ssa-sccvn.c:5492)
authorRichard Biener <rguenther@suse.de>
Thu, 24 Oct 2019 11:23:54 +0000 (11:23 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 24 Oct 2019 11:23:54 +0000 (11:23 +0000)
2019-10-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92203
* treee-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
Skip eliminating conversion stmts inserted by insertion.

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

From-SVN: r277374

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr92203.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index e0c4c1759cd3ea506f6aa7f02b7dd34232554c61..48733302092c135ff890f753ecb68555b7d57ded 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92203
+       * treee-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
+       Skip eliminating conversion stmts inserted by insertion.
+
 2019-10-24  Ilya Leoshkevich  <iii@linux.ibm.com>
 
        * config/s390/s390.c (s390_get_thread_pointer): Use
index 14975632c650b01416a5e2ad36c603edfd7ea3b4..5a1cd91461c7915b509c114b0e3241af6210af40 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92203
+       * gcc.dg/torture/pr92203.c: New testcase.
+
 2019-10-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/65930
diff --git a/gcc/testsuite/gcc.dg/torture/pr92203.c b/gcc/testsuite/gcc.dg/torture/pr92203.c
new file mode 100644 (file)
index 0000000..c752969
--- /dev/null
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wno-div-by-zero" } */
+
+unsigned long int rr;
+
+void
+cw (int z9)
+{
+  int m5;
+  unsigned long int vz = 0;
+  long int *na;
+
+  if (z9 == 0)
+    rr = 0;
+  else
+    {
+      na = (long int *) &m5;
+      for (*na = 0; *na < 1; ++*na)
+       {
+         na = (long int *) &vz;
+         rr /= 0;
+       }
+    }
+
+  m5 = rr / 5;
+  ++vz;
+  if (vz != 0)
+    while (z9 < 1)
+      {
+       if (m5 >= 0)
+         rr += m5;
+
+       na = (long int *) &rr;
+       if (*na >= 0)
+         rr = 0;
+      }
+}
index 57331ab44dc78c16d97065cd28e8c4cdcbf8d96e..3872168a4ed106c6ece0dd2e78cd7a2ad8ec5f19 100644 (file)
@@ -5459,8 +5459,13 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
 
          /* If this is an assignment from our leader (which
             happens in the case the value-number is a constant)
-            then there is nothing to do.  */
-         if (gimple_assign_single_p (stmt)
+            then there is nothing to do.  Likewise if we run into
+            inserted code that needed a conversion because of
+            our type-agnostic value-numbering of loads.  */
+         if ((gimple_assign_single_p (stmt)
+              || (is_gimple_assign (stmt)
+                  && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
+                      || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)))
              && sprime == gimple_assign_rhs1 (stmt))
            return;