aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1996-05-06 16:39:46 -0700
committerJim Wilson <wilson@gcc.gnu.org>1996-05-06 16:39:46 -0700
commitcff3d762dc57a3a91e1dfaeccb9fbee5457b6e40 (patch)
tree7e08a1c1618bc0d514e519f9a89294e355430109 /gcc
parentd2cba896e1a0bee36ee2367efa943efbf0036577 (diff)
downloadgcc-cff3d762dc57a3a91e1dfaeccb9fbee5457b6e40.zip
gcc-cff3d762dc57a3a91e1dfaeccb9fbee5457b6e40.tar.gz
gcc-cff3d762dc57a3a91e1dfaeccb9fbee5457b6e40.tar.bz2
(gen_shifty_op): Truncate VALUE to avoid out of bounds array access.
From-SVN: r11947
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/sh/sh.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 764bf31..1f3e43c 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -901,6 +901,9 @@ gen_shifty_op (code, operands)
int value = INTVAL (operands[2]);
int max, i;
+ /* Truncate the shift count in case it is out of bounds. */
+ value = value & 0x1f;
+
if (value == 31)
{
if (code == LSHIFTRT)