diff options
author | Andrew Haley <aph@redhat.com> | 2001-07-09 15:25:34 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2001-07-09 15:25:34 +0000 |
commit | 053a35af653f47c7fa2d8addc2a37714446e9948 (patch) | |
tree | 893e05c4344b127d055622ac707e30c71feed8d0 /gcc/expmed.c | |
parent | 7e54f5b80a38372c05aa9f19937a88ec5681b0ab (diff) | |
download | gcc-053a35af653f47c7fa2d8addc2a37714446e9948.tar.gz |
expmed.c (store_fixed_bit_field): Don't use a mode bigger than the mode of the memory location.
2001-07-03 Andrew Haley <aph@redhat.com>
* expmed.c (store_fixed_bit_field): Don't use a mode bigger than
the mode of the memory location.
From-SVN: r43864
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 0a9b41cfdf4..d334f6dad1f 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -673,10 +673,15 @@ store_fixed_bit_field (op0, offset, bitsize, bitpos, value, struct_align) { /* Get the proper mode to use for this field. We want a mode that includes the entire field. If such a mode would be larger than - a word, we won't be doing the extraction the normal way. */ + a word, we won't be doing the extraction the normal way. + We don't want a mode bigger than the destination. */ + mode = GET_MODE (op0); + if (GET_MODE_BITSIZE (mode) == 0 + || GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (word_mode)) + mode = word_mode; mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT, - struct_align, word_mode, + struct_align, mode, GET_CODE (op0) == MEM && MEM_VOLATILE_P (op0)); if (mode == VOIDmode) |