From 609524d29c7471cf4e26cce50b082868428bb572 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 5 Feb 2014 15:34:30 +0100 Subject: re PR middle-end/57499 (ICE when noreturn destructor returns after throw with -O) 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/tree-eh.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/tree-eh.c') diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index e9c714c..857ee45 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -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); -- cgit v1.1