]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/57499 (ICE when noreturn destructor returns after throw with -O)
authorJakub Jelinek <jakub@gcc.gnu.org>
Wed, 5 Feb 2014 14:34:30 +0000 (15:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 5 Feb 2014 14:34:30 +0000 (15:34 +0100)
PR middle-end/57499
* tree-eh.c (cleanup_empty_eh): Bail out on totally empty
bb with no successors.

* g++.dg/torture/pr57499.C: New test.

From-SVN: r207504

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

index be732f1416eea793437d8b1242d7e444b71b2ebf..9d26481242d75fece99d7b9d68186769058a9db1 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/57499
+       * tree-eh.c (cleanup_empty_eh): Bail out on totally empty
+       bb with no successors.
+
 2014-02-05  James Greenhalgh  <james.greenhalgh@arm.com>
 
        PR target/59718
index 2f154f44e27e74f6f9078af3a278a5590e2206e2..68ef6ada1e4795b1c079de396e688e7a65063d66 100644 (file)
@@ -1,6 +1,11 @@
+2014-02-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/57499
+       * g++.dg/torture/pr57499.C: New test.
+
 2014-02-05  Yury Gribov  <y.gribov@samsung.com>
 
-       * gcc.dg/asan/nosanitize-and-inline.c: New test.
+       * gcc.dg/asan/nosanitize-and-inline.c: New test.
 
 2014-02-04  Jan Hubicka  <hubicka@ucw.cz>
 
diff --git a/gcc/testsuite/g++.dg/torture/pr57499.C b/gcc/testsuite/g++.dg/torture/pr57499.C
new file mode 100644 (file)
index 0000000..fd985a1
--- /dev/null
@@ -0,0 +1,14 @@
+// PR middle-end/57499
+// { dg-do compile }
+
+struct S
+{
+  ~S () __attribute__ ((noreturn)) {} // { dg-warning "function does return" }
+};
+
+void
+foo ()
+{
+  S s;
+  throw 1;
+}
index e9c714c7714a9b15908e1a76cff74ec3b86be528..857ee4581bca9a569552d5ca620a2c2b569b0bc9 100644 (file)
@@ -4396,8 +4396,11 @@ cleanup_empty_eh (eh_landing_pad lp)
   /* If the block is totally empty, look for more unsplitting cases.  */
   if (gsi_end_p (gsi))
     {
-      /* For the degenerate case of an infinite loop bail out.  */
-      if (infinite_empty_loop_p (e_out))
+      /* For the degenerate case of an infinite loop bail out.
+        If bb has no successors and is totally empty, which can happen e.g.
+        because of incorrect noreturn attribute, bail out too.  */
+      if (e_out == NULL
+         || infinite_empty_loop_p (e_out))
        return ret;
 
       return ret | cleanup_empty_eh_unsplit (bb, e_out, lp);