summaryrefslogtreecommitdiffstats
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1998-10-21 19:27:19 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1998-10-21 19:27:19 +0000
commitedffc66dbb7f83d8b92ea818f5460dad43b62039 (patch)
treee74cf64bef6571029f944536af0afa7cd3a4dc62 /gcc/expmed.c
parent7b8220fe7d19aab6ad4c274fc80f8acaf4839148 (diff)
downloadppe42-gcc-edffc66dbb7f83d8b92ea818f5460dad43b62039.tar.gz
ppe42-gcc-edffc66dbb7f83d8b92ea818f5460dad43b62039.zip
Fix sparc builtin_memcpy miscompilation.
* expmed.c (store_bit_field): If need to add a SUBREG, then remove existing SUBREG if we can, otherwise abort. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23215 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 1c9fcf57829..2836c4cdf6d 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -423,7 +423,18 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size)
|| GET_MODE_SIZE (GET_MODE (op0)) > UNITS_PER_WORD)
{
if (GET_CODE (op0) != REG)
- op0 = copy_to_reg (op0);
+ {
+ /* Since this is a destination (lvalue), we can't copy it to a
+ pseudo. We can trivially remove a SUBREG that does not
+ change the size of the operand. Such a SUBREG may have been
+ added above. Otherwise, abort. */
+ if (GET_CODE (op0) == SUBREG
+ && (GET_MODE_SIZE (GET_MODE (op0))
+ == GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0)))))
+ op0 = SUBREG_REG (op0);
+ else
+ abort ();
+ }
op0 = gen_rtx_SUBREG (mode_for_size (BITS_PER_WORD, MODE_INT, 0),
op0, offset);
}
OpenPOWER on IntegriCloud