[PATCH] Fix sel-sched ICE with __builtin_unreachable (PR rtl-optimization/45353)

Vladimir N. Makarov vmakarov@redhat.com
Fri Aug 20 17:32:00 GMT 2010


On 08/20/2010 11:49 AM, Jakub Jelinek wrote:
> Hi!
>
> The testcase in the patch ICEs, because with __builtin_unreachable ()
> there is a basic block containing just notes, followed by BARRIER, and
> BARRIER doesn't have BLOCK_FOR_INSN.  BARRIERs are always after the bb
> though, so we should handle it like BLOCK_FOR_INSN (head) != bb.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux with yes,rtl checking,
> ok for trunk?
>
>    
Sure.  Thanks, Jakub.
> 2010-08-20  Jakub Jelinek<jakub@redhat.com>
>
> 	PR rtl-optimization/45353
> 	* sel-sched-ir.c (sel_bb_head): Return NULL even if next_nonnote_insn
> 	after bb_note is a BARRIER.
>
> 	* gcc.dg/pr45353.c: New test.
>
> --- gcc/sel-sched-ir.c.jj	2010-07-09 13:44:24.000000000 +0200
> +++ gcc/sel-sched-ir.c	2010-08-20 14:14:57.000000000 +0200
> @@ -4326,7 +4326,7 @@ sel_bb_head (basic_block bb)
>         note = bb_note (bb);
>         head = next_nonnote_insn (note);
>
> -      if (head&&  BLOCK_FOR_INSN (head) != bb)
> +      if (head&&  (BARRIER_P (head) || BLOCK_FOR_INSN (head) != bb))
>   	head = NULL_RTX;
>       }
>
> --- gcc/testsuite/gcc.dg/pr45353.c.jj	2010-08-20 14:17:44.000000000 +0200
> +++ gcc/testsuite/gcc.dg/pr45353.c	2010-08-20 14:17:24.000000000 +0200
> @@ -0,0 +1,9 @@
> +/* PR rtl-optimization/45353 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fschedule-insns -fselective-scheduling" } */
> +
> +void
> +foo ()
> +{
> +  __builtin_unreachable ();
> +}
>
> 	Jakub
>    



More information about the Gcc-patches mailing list