aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2003-04-18 22:27:18 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2003-04-18 18:27:18 -0400
commit21102f257e4fc2ddf71eaa26806b4adb133ff5ad (patch)
tree87d6d5d99bfa49b9a7f1e33d4040350b109ccf12
parent38afb23f55aae5e04bcc5e401ae0fb1d26b0ee22 (diff)
downloadgcc-21102f257e4fc2ddf71eaa26806b4adb133ff5ad.zip
gcc-21102f257e4fc2ddf71eaa26806b4adb133ff5ad.tar.gz
gcc-21102f257e4fc2ddf71eaa26806b4adb133ff5ad.tar.bz2
* expmed.c (mask_rtx): Avoid undefined shifts for BITSIZE of 0.
From-SVN: r65796
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/expmed.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0847ad9..3df6d2c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2003-04-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * expmed.c (mask_rtx): Avoid undefined shifts for BITSIZE of 0.
+
2003-04-18 Olivier Hainque <hainque@act-europe.fr>
* calls.c (expand_call): Move special case for constructor calls
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 33d8152..b48576b 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1698,7 +1698,9 @@ mask_rtx (mode, bitpos, bitsize, complement)
{
HOST_WIDE_INT masklow, maskhigh;
- if (bitpos < HOST_BITS_PER_WIDE_INT)
+ if (bitsize == 0)
+ masklow = 0;
+ else if (bitpos < HOST_BITS_PER_WIDE_INT)
masklow = (HOST_WIDE_INT) -1 << bitpos;
else
masklow = 0;
@@ -1712,7 +1714,9 @@ mask_rtx (mode, bitpos, bitsize, complement)
else
maskhigh = (HOST_WIDE_INT) -1 << (bitpos - HOST_BITS_PER_WIDE_INT);
- if (bitpos + bitsize > HOST_BITS_PER_WIDE_INT)
+ if (bitsize == 0)
+ maskhigh = 0;
+ else if (bitpos + bitsize > HOST_BITS_PER_WIDE_INT)
maskhigh &= ((unsigned HOST_WIDE_INT) -1
>> (2 * HOST_BITS_PER_WIDE_INT - bitpos - bitsize));
else