This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
MIPS patch to fix miscompilation of _Unwind_Resume
- To: gcc-patches at gcc dot gnu dot org
- Subject: MIPS patch to fix miscompilation of _Unwind_Resume
- From: Richard Sandiford <r dot sandiford at redhat dot com>
- Date: 10 Aug 2001 11:03:11 +0100
I was seeing a lot of EH failures due to a miscompilation of _Unwind_Resume.
The eh_return code that sets the new return address was being scheduled
after the epilogue instruction that loads it. And that happened because
mips.c:save_restore_insns() marks each register save slot as "unchanging".
Patch tested (in combination with others) on mips-elf with mips1/O32,
mips3/N64, mips3/O32, mips4/N64 and mips4/O32 multilibs. OK to install?
* config/mips/mips.c (save_restore_insns): Don't mark the RA's
stack slot as unchanging if current_function_calls_eh_return.
Index: mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.136
diff -c -p -d -r1.136 mips.c
*** mips.c 2001/08/09 11:31:23 1.136
--- mips.c 2001/08/10 08:57:13
*************** save_restore_insns (store_p, large_reg,
*** 6608,6614 ****
gen_rtx (PLUS, Pmode, base_reg_rtx,
GEN_INT (gp_offset - base_offset)));
! RTX_UNCHANGING_P (mem_rtx) = 1;
/* The mips16 does not have an instruction to load
$31, so we load $7 instead, and work things out
--- 6624,6632 ----
gen_rtx (PLUS, Pmode, base_reg_rtx,
GEN_INT (gp_offset - base_offset)));
! if (regno != GP_REG_FIRST + 31
! || ! current_function_calls_eh_return)
! RTX_UNCHANGING_P (mem_rtx) = 1;
/* The mips16 does not have an instruction to load
$31, so we load $7 instead, and work things out