[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug optimization/14838] [3.3/3.4/3.5 Regression] ICE when building with -O2 -g



------- Additional Comments From danglin at gcc dot gnu dot org  2004-04-04 20:54 -------
The ICE is generated by a call to insn_default_length in 
pa_output_function_epilogue.  It does a call to get_last_nonnote_insn
to get the last nonnote insn.  However, in this case, get_last_nonnote_insn
doesn't actually return the last nonnote insn.  It returns the next to
last nonnote insn which is the `use' insn which insn_default_length
doesn't like.

The code in get_last_nonnote_insn assumes that the last insn in the
current sequence or current function is a note.  However, when
get_last_nonnote_insn is called, the last insn is

(jump_insn 55 31 0 (parallel [
            (return)
            (use (reg:SI 2 %r2))
            (const_int 0 [0x0])
        ]) 184 {return} (insn_list:REG_DEP_ANTI 31 (insn_list 41 (nil)))
    (expr_list:REG_BR_PRED (const_int 12 [0xc])
        (expr_list:REG_DEAD (reg:SI 2 %r2)
            (nil))))

We did have the following note:

(note 71 55 0 NOTE_INSN_DELETED)

However, it is removed by a call to remove_insn:

Breakpoint 13, remove_insn (insn=0x40196580) at ../../gcc/gcc/emit-rtl.c:3578
3578      rtx next = NEXT_INSN (insn);
(gdb) bt
#0  remove_insn (insn=0x40196580) at ../../gcc/gcc/emit-rtl.c:3578
#1  0x0011bb8c in delete_insn (insn=0x40196580) at ../../gcc/gcc/cfgrtl.c:149
#2  0x00113f5c in reemit_insn_block_notes () at ../../gcc/gcc/cfglayout.c:559
#3  0x001ebef0 in final_start_function (first=0x401961a0, file=0x66ddd0,
    optimize=2) at ../../gcc/gcc/final.c:1374
#4  0x00470108 in rest_of_handle_final (decl=0x4021af50, insns=0x401961a0)
    at ../../gcc/gcc/passes.c:447

The comment for NOTE_INSN_DELETED says

  /* This note is used to get rid of an insn
     when it isn't safe to patch the insn out of the chain.  */

So, I don't think delete_insn should be trying to remove this note.  If
the note isn't removed, then get_last_nonnote_insn will work correctly
and we shouldn't get the ICE.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



Reply to: