aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-z80.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-02 10:26:31 +0930
committerAlan Modra <amodra@gmail.com>2020-09-02 16:30:43 +0930
commit01a6f9da644e52fbd644a8e8f58d58c0383118c8 (patch)
treec6bb7ced5b4fab8dc3d1d94d26102a34ec9492ae /gas/config/tc-z80.c
parent6228e2790a72b3335e12d7604ba60f0d3fa1c880 (diff)
downloadgdb-01a6f9da644e52fbd644a8e8f58d58c0383118c8.zip
gdb-01a6f9da644e52fbd644a8e8f58d58c0383118c8.tar.gz
gdb-01a6f9da644e52fbd644a8e8f58d58c0383118c8.tar.bz2
ubsan: tc-z80.c:3656 shift exponent 32 is too large
* config/tc-z80.c (is_overflow): Avoid too large shift.
Diffstat (limited to 'gas/config/tc-z80.c')
-rw-r--r--gas/config/tc-z80.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 45fcd6f..2e17d00 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -3653,7 +3653,7 @@ md_assemble (char *str)
static int
is_overflow (long value, unsigned bitsize)
{
- long fieldmask = (1UL << bitsize) - 1;
+ long fieldmask = (2UL << (bitsize - 1)) - 1;
long signmask = ~fieldmask;
long a = value & fieldmask;
long ss = a & signmask;