This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix ICE with MODIFIED_NORETURN_CALLS (PR middle-end/37913)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jakub Jelinek" <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 Oct 2008 14:51:58 +0100
- Subject: Re: [PATCH] Fix ICE with MODIFIED_NORETURN_CALLS (PR middle-end/37913)
- References: <20081028113037.GA14706@tyan-ft48-01.lab.bos.redhat.com>
On Tue, Oct 28, 2008 at 12:30 PM, Jakub Jelinek <firstname.lastname@example.org> wrote:
> MODIFIED_NORETURN_CALLS keeps stmts around until cfg cleanup, but by the
> time cfg cleanup is performed, the stmt might be deleted (that's handled in
> the code) but also the containing block might be deleted. In this case, as
> shown on the attached testcase, we ICE splitting an already deleted bb.
> Fixed by verifying stmt's bb is still in the cfg. Bootstrapped/regtested on
> x86_64-linux, ok for trunk?
Looks like a kludge, but I don't see any better solution. So, ok if you add
a comment before the checks as to what they are really checking.
> 2008-10-28 Jakub Jelinek <email@example.com>
> 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.
> --- gcc/tree-cfgcleanup.c.jj 2008-09-30 16:57:11.000000000 +0200
> +++ gcc/tree-cfgcleanup.c 2008-10-28 11:07:46.000000000 +0100
> @@ -484,6 +484,9 @@ split_bbs_on_noreturn_calls (void)
> stmt = VEC_pop (gimple, MODIFIED_NORETURN_CALLS (cfun));
> bb = gimple_bb (stmt);
> 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))
> --- gcc/testsuite/gcc.c-torture/compile/pr37913.c.jj 2008-10-28 11:10:42.000000000 +0100
> +++ gcc/testsuite/gcc.c-torture/compile/pr37913.c 2008-10-28 11:10:20.000000000 +0100
> @@ -0,0 +1,15 @@
> +/* PR middle-end/37913 */
> +void foo (void) __attribute__ ((noreturn));
> +static int __attribute__ ((noreturn))
> +bar (void)
> + foo ();
> +baz (void)
> + int i = bar ();