aboutsummaryrefslogtreecommitdiff
path: root/opcodes/arc-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-10 19:09:47 +1030
committerAlan Modra <amodra@gmail.com>2019-12-11 11:37:25 +1030
commita11db3e9f3a679601f41671a9e7f54c37f2c5073 (patch)
tree39fd64660e6dce076b332d9ba2e73f974b7fb131 /opcodes/arc-dis.c
parent9d48687b41f17ccbd7c61dd76b96147f28916951 (diff)
downloadgdb-a11db3e9f3a679601f41671a9e7f54c37f2c5073.zip
gdb-a11db3e9f3a679601f41671a9e7f54c37f2c5073.tar.gz
gdb-a11db3e9f3a679601f41671a9e7f54c37f2c5073.tar.bz2
ubsan: arc: shift exponent 32 is too large for 32-bit type 'int'
When operand->bits is 32, the following results in UB. value = (insn >> operand->shift) & ((1 << operand->bits) - 1); * arc-dis.c (find_format_from_table): Use ull constant when shifting by up to 32.
Diffstat (limited to 'opcodes/arc-dis.c')
-rw-r--r--opcodes/arc-dis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index 3c88c33..a038fa0 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -295,7 +295,7 @@ find_format_from_table (struct disassemble_info *info,
if (operand->extract)
value = (*operand->extract) (insn, &invalid);
else
- value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
+ value = (insn >> operand->shift) & ((1ull << operand->bits) - 1);
/* Check for LIMM indicator. If it is there, then make sure
we pick the right format. */