re PR tree-optimization/85168 (ICE in tree-ssa-coalesce.c: SSA corruption: Unable...
authorRichard Biener <rguenther@suse.de>
Wed, 4 Apr 2018 07:52:20 +0000 (07:52 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 4 Apr 2018 07:52:20 +0000 (07:52 +0000)
2018-04-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/85168
* tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Avoid
propagating abnormals.

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

From-SVN: r259068

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

index a861a189e3f8ff9ec685ac8b3f86f20bc9c2b65f..1370b34f466aaa23fd98240d145a9419840bc368 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/85168
+       * tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Avoid
+       propagating abnormals.
+
 2018-04-04  Chung-Ju Wu  <jasonwucj@gmail.com>
 
        * config/nds32/nds32.md (enabled): Use yes/no for this attribute.
index 95cd7c8392d979316502a0f3abe8b83ce2147c66..5c72bd78387f7562a598c3f20c1c6fa77123ea70 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/85168
+       * gcc.dg/torture/pr85168.c: New testcase.
+
 2018-04-04  Alexandre Oliva <aoliva@redhat.com>
 
        PR c++/84943
diff --git a/gcc/testsuite/gcc.dg/torture/pr85168.c b/gcc/testsuite/gcc.dg/torture/pr85168.c
new file mode 100644 (file)
index 0000000..cc5e664
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target indirect_jumps } */
+
+typedef struct {
+    struct {
+       char a;
+    } b;
+} c;
+
+int d, f;
+c *e;
+
+extern void i(void);
+extern void sejtmp () __attribute__((returns_twice));
+
+void g(void)
+{
+  c *h = e;
+  if (f)
+    {
+      i();
+      h--;
+      if (d)
+       if (h->b.a)
+         i();
+    }
+  if (h->b.a)
+    sejtmp();
+  e = h;
+}
index fea452bd132033795b98358f8e4bb11d38a1502f..4e5f3385f9d80da11491cc27ec4a0773d4ffab41 100644 (file)
@@ -1249,7 +1249,9 @@ vn_reference_maybe_forwprop_address (vec<vn_reference_op_s> *ops,
          return true;
        }
       if (!addr_base
-         || TREE_CODE (addr_base) != MEM_REF)
+         || TREE_CODE (addr_base) != MEM_REF
+         || (TREE_CODE (TREE_OPERAND (addr_base, 0)) == SSA_NAME
+             && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (addr_base, 0))))
        return false;
 
       off += addr_offset;
@@ -1262,6 +1264,7 @@ vn_reference_maybe_forwprop_address (vec<vn_reference_op_s> *ops,
       ptr = gimple_assign_rhs1 (def_stmt);
       ptroff = gimple_assign_rhs2 (def_stmt);
       if (TREE_CODE (ptr) != SSA_NAME
+         || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ptr)
          || TREE_CODE (ptroff) != INTEGER_CST)
        return false;