Before the target was removed, IRIX defined DWARF_FRAME_RETURN_COLUMN to be reg 64, which is something other than INCOMING_RETURN_ADDR_RTX (reg 31). This means that when we see a save of reg 31, we discover that this is really a save of reg 64 and produce dwarf information accordingly. However, there is nothing that handles a restore of reg 31 specially, which means that reg 64 is unaffected by it. This is a problem when shrink-wrapping, if we end up merging two paths where one can arrive directly from the function start, and another where we've gone through a save/restore of reg 31. The paths will disagree on where reg 64 is saved.
The following patch fixes it by handling restores of INCOMING_RETURN_ADDR_RTX specially if it is different from DWARF_FRAME_RETURN_COLUMN. Bootstrapped and tested on x86_64-linux, and also bootstrapped by Rainer Orth on IRIX with 4.7.3. Ok? Bernd
* dwarf2cfi.c (dwarf2out_frame_debug_cfa_restore): When restoring INCOMING_RETURN_ADDR_RTX, and it is different from DWARF_FRAME_RETURN_COLUMN, mark the latter as saved in the former. Index: gcc/dwarf2cfi.c =================================================================== --- gcc/dwarf2cfi.c (revision 189425) +++ gcc/dwarf2cfi.c (working copy) @@ -1240,6 +1240,10 @@ dwarf2out_frame_debug_cfa_restore (rtx r add_cfi_restore (regno); update_row_reg_save (cur_row, regno, NULL); + if (REG_P (INCOMING_RETURN_ADDR_RTX) + && regno == dwf_regno (INCOMING_RETURN_ADDR_RTX) + && regno != DWARF_FRAME_RETURN_COLUMN) + reg_save (DWARF_FRAME_RETURN_COLUMN, regno, 0); } /* A subroutine of dwarf2out_frame_debug, process a REG_CFA_WINDOW_SAVE.