re PR tree-optimization/64280 (ICE in replace_uses_by, at tree-cfg.c:1789)
authorRichard Biener <rguenther@suse.de>
Fri, 12 Dec 2014 13:26:15 +0000 (13:26 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 12 Dec 2014 13:26:15 +0000 (13:26 +0000)
2014-12-12  Richard Biener  <rguenther@suse.de>

PR middle-end/64280
* tree-cfg.c (replace_uses_by): Guard assert properly.

* g++.dg/torture/pr64280.C: New testcase.

From-SVN: r218668

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr64280.C [new file with mode: 0644]
gcc/tree-cfg.c

index 85eceaf5659846ba4764d3188760ba2805e048f3..95f885bc435c2dbeaa64d36416ee0340f20d513f 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-12  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/64280
+       * tree-cfg.c (replace_uses_by): Guard assert properly.
+
 2014-12-12  Anthony Green  <green@moxielogic.com>
 
        * config/moxie/moxie.md: Add use of zex instruction.
index e4eb34b57025f9bb3cf7953a2b9e230a7f5e34a2..5b485a97708b6c7c19e78303f668e5f0770cd635 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-12  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/64280
+       * g++.dg/torture/pr64280.C: New testcase.
+
 2014-12-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/64255
diff --git a/gcc/testsuite/g++.dg/torture/pr64280.C b/gcc/testsuite/g++.dg/torture/pr64280.C
new file mode 100644 (file)
index 0000000..6ea3148
--- /dev/null
@@ -0,0 +1,42 @@
+// { dg-do compile }
+
+class A
+{
+public:
+  A ();
+};
+class B
+{
+public:
+  B (int);
+  operator void *() { return m_fn1 () ? 0 : this; }
+  int m_fn1 ();
+};
+typedef int jmp_buf[];
+struct C
+{
+  jmp_buf cond_;
+};
+class F
+{
+  C what_;
+  bool m_fn2 ();
+};
+int _setjmp (int[]);
+void longjmp ();
+class D
+{
+public:
+  D () { longjmp (); }
+};
+bool
+F::m_fn2 ()
+{
+  B a (0);
+  if (a)
+    if (_setjmp (what_.cond_))
+      return 0;
+    else
+      D ();
+  A b;
+}
index 6aca58d27d69fdd7aaf5643c6dc52259a0930b52..0ae4bd76f408910196e213cff324634c95de61f8 100644 (file)
@@ -1781,7 +1781,8 @@ replace_uses_by (tree name, tree val)
            {
              e = gimple_phi_arg_edge (as_a <gphi *> (stmt),
                                       PHI_ARG_INDEX_FROM_USE (use));
-             if (e->flags & EDGE_ABNORMAL)
+             if (e->flags & EDGE_ABNORMAL
+                 && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val))
                {
                  /* This can only occur for virtual operands, since
                     for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))