This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix ICE with MODIFIED_NORETURN_CALLS (PR middle-end/37913)


On Tue, Oct 28, 2008 at 12:30 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> 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.

Thanks,
Richard.

> 2008-10-28  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.
>
>        * 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))
>          continue;
> --- 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 ();
> +}
> +
> +void
> +baz (void)
> +{
> +  int i = bar ();
> +}
>
>        Jakub
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]