aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-mips.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-02 10:20:53 +0930
committerAlan Modra <amodra@gmail.com>2020-09-02 16:30:43 +0930
commit7697028a6cff4ba5465c0b3256697df48bd2c60e (patch)
tree72749520572296c65e90c4c5e6f6e6ea40e89e04 /gas/config/tc-mips.c
parent602e9f0ae74cb349005d259ae50527fb72803f54 (diff)
downloadgdb-7697028a6cff4ba5465c0b3256697df48bd2c60e.zip
gdb-7697028a6cff4ba5465c0b3256697df48bd2c60e.tar.gz
gdb-7697028a6cff4ba5465c0b3256697df48bd2c60e.tar.bz2
ubsan: tc-mips.c:9606 shift exponent 32 is too large
* config/tc-mips.c (load_register): Avoid too large shift.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r--gas/config/tc-mips.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 7d0d5a1..81e2370 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -9603,8 +9603,11 @@ load_register (int reg, expressionS *ep, int dbl)
lo >>= 1;
++bit;
}
- lo |= (hi & (((unsigned long) 1 << bit) - 1)) << (32 - bit);
- hi >>= bit;
+ if (bit != 0)
+ {
+ lo |= (hi & ((2UL << (bit - 1)) - 1)) << (32 - bit);
+ hi >>= bit;
+ }
}
else
{