aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@act-europe.fr>2003-04-21 23:32:06 +0200
committerRichard Kenner <kenner@gcc.gnu.org>2003-04-21 17:32:06 -0400
commit0d2f38ee4068f6d836a975f9e91663f72e17d93e (patch)
tree28e1168b00fd20a7fceed802205b8b1947fdeec4 /gcc/expmed.c
parentd79f9ec9ffb6aa93e0bd6479ac12564eb27b46c1 (diff)
downloadgcc-0d2f38ee4068f6d836a975f9e91663f72e17d93e.zip
gcc-0d2f38ee4068f6d836a975f9e91663f72e17d93e.tar.gz
gcc-0d2f38ee4068f6d836a975f9e91663f72e17d93e.tar.bz2
expmed.c (extract_bit_field): Reverse operands of && condition to prevent a potential division by zero in the...
* expmed.c (extract_bit_field): Reverse operands of && condition to prevent a potential division by zero in the previously first branch. * config/pa/pa.md (extv, extzv): FAIL if the bitfield length is zero. From-SVN: r65907
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index b48576b..5cc0894 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1104,25 +1104,25 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
? mode
: mode_for_size (bitsize, GET_MODE_CLASS (tmode), 0));
- if (((GET_CODE (op0) != MEM
- && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
- GET_MODE_BITSIZE (GET_MODE (op0)))
- && GET_MODE_SIZE (mode1) != 0
- && byte_offset % GET_MODE_SIZE (mode1) == 0)
- || (GET_CODE (op0) == MEM
- && (! SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (op0))
- || (offset * BITS_PER_UNIT % bitsize == 0
- && MEM_ALIGN (op0) % bitsize == 0))))
- && ((bitsize >= BITS_PER_WORD && bitsize == GET_MODE_BITSIZE (mode)
- && bitpos % BITS_PER_WORD == 0)
- || (mode_for_size (bitsize, GET_MODE_CLASS (tmode), 0) != BLKmode
- /* ??? The big endian test here is wrong. This is correct
- if the value is in a register, and if mode_for_size is not
- the same mode as op0. This causes us to get unnecessarily
- inefficient code from the Thumb port when -mbig-endian. */
- && (BYTES_BIG_ENDIAN
- ? bitpos + bitsize == BITS_PER_WORD
- : bitpos == 0))))
+ if (((bitsize >= BITS_PER_WORD && bitsize == GET_MODE_BITSIZE (mode)
+ && bitpos % BITS_PER_WORD == 0)
+ || (mode_for_size (bitsize, GET_MODE_CLASS (tmode), 0) != BLKmode
+ /* ??? The big endian test here is wrong. This is correct
+ if the value is in a register, and if mode_for_size is not
+ the same mode as op0. This causes us to get unnecessarily
+ inefficient code from the Thumb port when -mbig-endian. */
+ && (BYTES_BIG_ENDIAN
+ ? bitpos + bitsize == BITS_PER_WORD
+ : bitpos == 0)))
+ && ((GET_CODE (op0) != MEM
+ && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
+ GET_MODE_BITSIZE (GET_MODE (op0)))
+ && GET_MODE_SIZE (mode1) != 0
+ && byte_offset % GET_MODE_SIZE (mode1) == 0)
+ || (GET_CODE (op0) == MEM
+ && (! SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (op0))
+ || (offset * BITS_PER_UNIT % bitsize == 0
+ && MEM_ALIGN (op0) % bitsize == 0)))))
{
if (mode1 != GET_MODE (op0))
{