From: Alan Modra Date: Wed, 2 Sep 2020 00:50:53 +0000 (+0930) Subject: ubsan: tc-mips.c:9606 shift exponent 32 is too large X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7697028a6cff4ba5465c0b3256697df48bd2c60e;p=binutils-gdb.git ubsan: tc-mips.c:9606 shift exponent 32 is too large * config/tc-mips.c (load_register): Avoid too large shift. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 052c9541ff9..fece8b59412 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2020-09-02 Alan Modra + + * config/tc-mips.c (load_register): Avoid too large shift. + 2020-09-02 Alan Modra * config/tc-d30v.c (parallel_ok): Use 1UL for left shift expression. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 7d0d5a19918..81e2370eee6 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 {