aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2011-06-17 02:18:24 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2011-06-17 02:18:24 +0000
commit9a2091cd0a703e199c2c50225930071d00675a32 (patch)
tree691aeafddb0a87acbd9aac366c7ea95648cda6d0 /gcc/reload.c
parenta26335b56fa55e06467e54d2683b156943028c30 (diff)
downloadgcc-9a2091cd0a703e199c2c50225930071d00675a32.zip
gcc-9a2091cd0a703e199c2c50225930071d00675a32.tar.gz
gcc-9a2091cd0a703e199c2c50225930071d00675a32.tar.bz2
re PR rtl-optimization/48542 (unchanged variables in code which calls setjmp may be clobbered (including the return-address))
PR rtl-optimization/48542 * reload.c (find_equiv_reg): Stop looking when finding a setjmp-type call. * reload1.c (reload_as_needed): Invalidate all reload registers when crossing a setjmp-type call. From-SVN: r175132
Diffstat (limited to 'gcc/reload.c')
-rw-r--r--gcc/reload.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/reload.c b/gcc/reload.c
index 27d5787..3ad46b9 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -6791,6 +6791,15 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class rclass, int other,
|| num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS))
return 0;
+ /* Don't reuse register contents from before a setjmp-type
+ function call; on the second return (from the longjmp) it
+ might have been clobbered by a later reuse. It doesn't
+ seem worthwhile to actually go and see if it is actually
+ reused even if that information would be readily available;
+ just don't reuse it across the setjmp call. */
+ if (CALL_P (p) && find_reg_note (p, REG_SETJMP, NULL_RTX))
+ return 0;
+
if (NONJUMP_INSN_P (p)
/* If we don't want spill regs ... */
&& (! (reload_reg_p != 0