ubsan: tc-z80.c:3656 shift exponent 32 is too large

* config/tc-z80.c (is_overflow): Avoid too large shift.
This commit is contained in:
Alan Modra
2020-09-02 10:26:31 +09:30
parent 6228e2790a
commit 01a6f9da64
2 changed files with 5 additions and 1 deletions

View File

@@ -1,3 +1,7 @@
2020-09-02 Alan Modra <amodra@gmail.com>
* config/tc-z80.c (is_overflow): Avoid too large shift.
2020-09-02 Alan Modra <amodra@gmail.com>
* config/tc-sparc.c (in_signed_range): Use an unsigned type for

View File

@@ -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;