aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-10-29 16:19:24 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-10-29 16:19:24 +0100
commit4d731f1702c373c4ce2efcd1adb2b4720cc223d5 (patch)
treeb4c49a7a8cdfe8442ec39b009e7cc9cd2ea509f0 /gcc
parenta848cf52b5e71ebeb05a23888ff3660c4f5012b8 (diff)
downloadgcc-4d731f1702c373c4ce2efcd1adb2b4720cc223d5.zip
gcc-4d731f1702c373c4ce2efcd1adb2b4720cc223d5.tar.gz
gcc-4d731f1702c373c4ce2efcd1adb2b4720cc223d5.tar.bz2
re PR middle-end/37913 (ICE: Segmentation fault in link_block, cfg.c:153)
PR middle-end/37913 * tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Only split bbs that haven't been removed yet. * gcc.c-torture/compile/pr37913.c: New test. From-SVN: r141426
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37913.c15
-rw-r--r--gcc/tree-cfgcleanup.c5
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 643ca32..80e06ce 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37913
+ * tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Only split bbs
+ that haven't been removed yet.
+
2008-10-29 Bernd Schmidt <bernd.schmidt@analog.com>
* config/bfin/bfin.c (struct machine_function): New member
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1432987..2e23d6d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2008-10-28 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/37913
+ * gcc.c-torture/compile/pr37913.c: New test.
+
+2008-10-28 Jakub Jelinek <jakub@redhat.com>
+
PR tree-optimization/37663
* gcc.dg/pr37663.c: Require int32plus.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37913.c b/gcc/testsuite/gcc.c-torture/compile/pr37913.c
new file mode 100644
index 0000000..98b8f64
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37913.c
@@ -0,0 +1,15 @@
+/* PR middle-end/37913 */
+
+void foo (void) __attribute__ ((noreturn));
+
+static int __attribute__ ((noreturn))
+bar (void)
+{
+ foo ();
+}
+
+void
+baz (void)
+{
+ int i = bar ();
+}
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 433900c..ba1854a 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -483,7 +483,12 @@ split_bbs_on_noreturn_calls (void)
{
stmt = VEC_pop (gimple, MODIFIED_NORETURN_CALLS (cfun));
bb = gimple_bb (stmt);
+ /* BB might be deleted at this point, so verify first
+ BB is present in the cfg. */
if (bb == NULL
+ || bb->index < NUM_FIXED_BLOCKS
+ || bb->index >= n_basic_blocks
+ || BASIC_BLOCK (bb->index) != bb
|| last_stmt (bb) == stmt
|| !gimple_call_noreturn_p (stmt))
continue;