aboutsummaryrefslogtreecommitdiff
path: root/gas/cgen.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-27 13:46:45 +0930
committerAlan Modra <amodra@gmail.com>2020-08-27 21:56:33 +0930
commit6fbd4a8e8baa7fe5adcaa1c11c885f741fccd250 (patch)
tree4b80225e1bf7e27a71628b88ef5db6976659c3fe /gas/cgen.c
parentcd570d497efca7b71ca999cb80d24bfcea5181ac (diff)
downloadgdb-6fbd4a8e8baa7fe5adcaa1c11c885f741fccd250.zip
gdb-6fbd4a8e8baa7fe5adcaa1c11c885f741fccd250.tar.gz
gdb-6fbd4a8e8baa7fe5adcaa1c11c885f741fccd250.tar.bz2
PR26467 UBSAN: cgen.c:762 shift exponent 18446744073709551615
PR 26467 * cgen.c (weak_operand_overflow_check): Handle opmask for operand length zero. Use 1UL constant.
Diffstat (limited to 'gas/cgen.c')
-rw-r--r--gas/cgen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/cgen.c b/gas/cgen.c
index 0bc44f6..7c924d1 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -759,7 +759,7 @@ weak_operand_overflow_check (const expressionS * exp,
{
const unsigned long len = operand->length;
unsigned long mask;
- unsigned long opmask = (((1L << (len - 1)) - 1) << 1) | 1;
+ unsigned long opmask = len == 0 ? 0 : (1UL << (len - 1) << 1) - 1;
if (!exp)
return NULL;