summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>1997-01-14 20:32:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>1997-01-14 20:32:22 +0000
commitc0560887e8974b500bf3d240f4f9e9d296071f0d (patch)
tree41e214d8c7232c83a5cf5e715a65ba2fe9a80607 /gcc/varasm.c
parent8839fca41b657d9ced3d73db60f1cb1198c7a32a (diff)
downloadgcc-c0560887e8974b500bf3d240f4f9e9d296071f0d.tar.gz
Copy a CONST_INT rtx in force_const_mem
From-SVN: r13490
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a13540932ae..c62fd7e6d99 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3407,19 +3407,25 @@ force_const_mem (mode, x)
pool_offset &= ~ (align - 1);
/* If RTL is not being placed into the saveable obstack, make a
- copy of X that is in the saveable obstack in case we are being
- called from combine or some other phase that discards memory
- it allocates. We need only do this if it is a CONST, since
- no other RTX should be allocated in this situation. */
+ copy of X that is in the saveable obstack in case we are
+ being called from combine or some other phase that discards
+ memory it allocates. We used to only do this if it is a
+ CONST; however, reload can allocate a CONST_INT when
+ eliminating registers. */
if (rtl_obstack != saveable_obstack
- && GET_CODE (x) == CONST)
+ && (GET_CODE (x) == CONST || GET_CODE (x) == CONST_INT))
{
push_obstacks_nochange ();
rtl_in_saveable_obstack ();
- x = gen_rtx (CONST, GET_MODE (x),
- gen_rtx (PLUS, GET_MODE (x),
- XEXP (XEXP (x, 0), 0), XEXP (XEXP (x, 0), 1)));
+ if (GET_CODE (x) == CONST)
+ x = gen_rtx (CONST, GET_MODE (x),
+ gen_rtx (PLUS, GET_MODE (x),
+ XEXP (XEXP (x, 0), 0),
+ XEXP (XEXP (x, 0), 1)));
+ else
+ x = GEN_INT (INTVAL (x));
+
pop_obstacks ();
}