[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273

eraman at google dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 16 17:04:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938

--- Comment #4 from Easwaran Raman <eraman at google dot com> 2012-10-16 17:04:05 UTC ---
(In reply to comment #3)
> Thanks Jörn.
> The problem is not related to my changes in PR 51244.  It is caused by the
> latest change to optabs.c:
> 
> 2012-10-15   Easwaran Raman  <eraman@google.com>
>     * optabs.c (emit_cmp_and_jump_insn_1): Add a new parameter to
>     specificy the probability of taking the jump.
>     (emit_cmp_and_jump_insns): Likewise.
> 
> 
> In emit_cmp_and_jump_insn_1, the line
> 
>       gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
> 
> blows up, because of config/sh/sh.c (expand_cbranchsi4):
> 
>   rtx jump = emit_jump_insn (branch_expander (operands[3]));
>   if (probability >= 0)
>     add_reg_note (jump, REG_BR_PROB, GEN_INT (probability));

I am confused why this code causes the assert in emit_cmp_and_jump_insn_1.
Could you please attach a stack trace? 

> 
> The following seems to fix the problem
> 
> Index: gcc/optabs.c
> ===================================================================
> --- gcc/optabs.c    (revision 192494)
> +++ gcc/optabs.c    (working copy)
> @@ -4270,8 +4270,8 @@
>        && JUMP_P (insn)
>        && any_condjump_p (insn))
>      {
> -      gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
> -      add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
> +      if (!find_reg_note (insn, REG_BR_PROB, 0))
> +        add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
>      }
>  }
> 
> 
> Easwaran, could you please have a look at that?  Does the change above make
> sense?

While this would certainly make the error go away, it will be good to
understand the root cause. If there is a REG_BR_PROB note already but the
probability is different from what is passed to emit_cmp_and_jump_insn_1,
should the existing value be replaced or left as such.

Thanks,
Easwaran



More information about the Gcc-bugs mailing list