aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-16 09:58:52 +1030
committerAlan Modra <amodra@gmail.com>2019-12-16 17:35:13 +1030
commit8a92faab92e359a860da6c69741acd1fac24dad6 (patch)
tree4232174c22a46a03a9309044f807d072595fa698
parente6ced26afd50b0d74b8ea14ca1cd62cdc5d11ae8 (diff)
downloadgdb-8a92faab92e359a860da6c69741acd1fac24dad6.zip
gdb-8a92faab92e359a860da6c69741acd1fac24dad6.tar.gz
gdb-8a92faab92e359a860da6c69741acd1fac24dad6.tar.bz2
ubsan: nios2: left shift cannot be represented in type 'int'
* nios2-dis.c (nios2_print_insn_arg): Avoid signed overflow
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/nios2-dis.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 1e13b1f..113fd09 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,9 @@
2019-12-16 Alan Modra <amodra@gmail.com>
+ * nios2-dis.c (nios2_print_insn_arg): Avoid signed overflow
+
+2019-12-16 Alan Modra <amodra@gmail.com>
+
* xstormy16-ibld.c: Regenerate.
2019-12-16 Alan Modra <amodra@gmail.com>
diff --git a/opcodes/nios2-dis.c b/opcodes/nios2-dis.c
index 731860c..d548adc 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, ",");