]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not merge BBs with a different EH landing pads (PR
authorMartin Liska <mliska@suse.cz>
Mon, 17 Oct 2016 13:19:04 +0000 (15:19 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 17 Oct 2016 13:19:04 +0000 (13:19 +0000)
Backported from mainline
2016-10-13  Martin Liska  <mliska@suse.cz>

PR tree-optimization/77943
* g++.dg/tree-ssa/pr77943.C: New test.
Backported from mainline
2016-10-13  Martin Liska  <mliska@suse.cz>

PR tree-optimization/77943
* tree-ssa-tail-merge.c (merge_stmts_p): Do not merge BBs with
a different EH landing pads.

From-SVN: r241240

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pr77943.C [new file with mode: 0644]
gcc/tree-ssa-tail-merge.c

index 8317108bfb62af3fc7f9c5bf6e379a9886566889..fd9138d1c6e8c7b6b35ce86a608882f7050cb219 100644 (file)
@@ -1,3 +1,12 @@
+2016-10-17  Martin Liska  <mliska@suse.cz>
+
+       Backported from mainline
+       2016-10-13  Martin Liska  <mliska@suse.cz>
+
+       PR tree-optimization/77943
+       * tree-ssa-tail-merge.c (merge_stmts_p): Do not merge BBs with
+       a different EH landing pads.
+
 2016-10-16  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.c (sparc_expand_vector_init): Only accept literal
index 3432792aa177c338b883ed3144098e1669a4f26a..f4f957203edf52acb9203f83bb76b8a0307198a5 100644 (file)
@@ -1,3 +1,11 @@
+2016-10-17  Martin Liska  <mliska@suse.cz>
+
+       Backported from mainline
+       2016-10-13  Martin Liska  <mliska@suse.cz>
+
+       PR tree-optimization/77943
+       * g++.dg/tree-ssa/pr77943.C: New test.
+
 2016-10-15  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.target/sparc/bmaskbshuf.c: Rename to...
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr77943.C b/gcc/testsuite/g++.dg/tree-ssa/pr77943.C
new file mode 100644 (file)
index 0000000..ef7954a
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -std=c++11" } */
+
+void thrower[[gnu::noinline]]() {
+    throw 1;
+}
+
+inline void fatal() noexcept {thrower();}
+inline void notFatal() {thrower();}
+
+void func(bool callFatal) {
+    if (callFatal) {
+        fatal();
+    } else { 
+        notFatal();
+    }
+}
+
+int main(int argc, const char* argv[]) {
+    try {
+        bool callFatal = argc > 1;
+        func(callFatal);
+    } catch (...) {
+    }
+}
index 6b4b589330ddc959bd6ef5ee399040950181591b..adcd9d42e90c2f7ce9732db044b3c198965a8c37 100644 (file)
@@ -237,6 +237,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "trans-mem.h"
 #include "stringpool.h"
 #include "tree-ssanames.h"
+#include "tree-eh.h"
 
 /* Describes a group of bbs with the same successors.  The successor bbs are
    cached in succs, and the successor edge flags are cached in succ_flags.
@@ -1273,6 +1274,11 @@ find_duplicate (same_succ same_succ, basic_block bb1, basic_block bb2)
          || is_tm_ending (stmt2))
        return;
 
+      /* Verify EH landing pads.  */
+      if (lookup_stmt_eh_lp_fn (cfun, stmt1)
+         != lookup_stmt_eh_lp_fn (cfun, stmt2))
+       return;
+
       if (!gimple_equal_p (same_succ, stmt1, stmt2))
        return;