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]

[commit, spu] Fix ICE due to use of uninitialized value in spu.c


Hello,

recently, we're seeing lots of internal compiler errors on the SPU of the form:
  internal compiler error: in check_cfg, at haifa-sched.c:5214

These were caused by spu_emit_branch_hint placing branch hints outside of any
basic block, due to an invalid decision caused by reading random values while
accessing the NOTE_KIND of a non-NOTE insn.

This bug has been in spu.c since forever; no idea why the problem would
suddenly manifest ...

Fixed by the obvious patch below.

Tested on spu-elf; committed to mainline.  Will commit to other branches
as well once regtest completes.

Bye,
Ulrich


ChangeLog:

	* config/spu/spu.c (spu_emit_branch_hint): Do not access NOTE_KIND of
	non-NOTE insns.

Index: gcc/config/spu/spu.c
===================================================================
*** gcc/config/spu/spu.c	(revision 162820)
--- gcc/config/spu/spu.c	(working copy)
*************** spu_emit_branch_hint (rtx before, rtx br
*** 2330,2336 ****
      return;
  
    /* If we have a Basic block note, emit it after the basic block note.  */
!   if (NOTE_KIND (before) == NOTE_INSN_BASIC_BLOCK)
      before = NEXT_INSN (before);
  
    branch_label = gen_label_rtx ();
--- 2330,2336 ----
      return;
  
    /* If we have a Basic block note, emit it after the basic block note.  */
!   if (NOTE_INSN_BASIC_BLOCK_P (before))
      before = NEXT_INSN (before);
  
    branch_label = gen_label_rtx ();
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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