ubsan: tc-mips.c:9606 shift exponent 32 is too large

* config/tc-mips.c (load_register): Avoid too large shift.
This commit is contained in:
Alan Modra 2020-09-02 10:20:53 +09:30
parent 602e9f0ae7
commit 7697028a6c
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2020-09-02 Alan Modra <amodra@gmail.com>
* config/tc-mips.c (load_register): Avoid too large shift.
2020-09-02 Alan Modra <amodra@gmail.com>
* config/tc-d30v.c (parallel_ok): Use 1UL for left shift expression.

View File

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