This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ubsan: nios2: left shift cannot be represented in type 'int'
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 16 Dec 2019 17:39:43 +1030
- Subject: ubsan: nios2: left shift cannot be represented in type 'int'
* nios2-dis.c (nios2_print_insn_arg): Avoid signed overflow
diff --git a/opcodes/nios2-dis.c b/opcodes/nios2-dis.c
index 731860c409..d548adc608 100644
--- a/opcodes/nios2-dis.c
+++ b/opcodes/nios2-dis.c
@@ -858,7 +858,7 @@ nios2_print_insn_arg (const char *argptr,
if (i & (1 << 10))
reglist |= (1 << 28);
if (i & (1 << 11))
- reglist |= (1 << 31);
+ reglist |= (1u << 31);
}
else
reglist = i << 2;
@@ -887,7 +887,7 @@ nios2_print_insn_arg (const char *argptr,
for (k = (dir == 1 ? 0 : 31);
(dir == 1 && k < 32) || (dir == -1 && k >= 0);
k += dir)
- if (reglist & (1 << k))
+ if (reglist & (1u << k))
{
if (t)
(*info->fprintf_func) (info->stream, ",");
--
Alan Modra
Australia Development Lab, IBM