summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-17 22:18:57 +1030
committerAlan Modra <amodra@gmail.com>2019-12-17 22:58:11 +1030
commite46d79a76ea748165a3ecd1102dd10498d089a49 (patch)
tree87624397389d62e7d08f6ffd0eac98106eac258c /opcodes
parent660df28acfa1b58c978d65d9cb26d37023f791ce (diff)
downloadbinutils-gdb-e46d79a76ea748165a3ecd1102dd10498d089a49.tar.gz
ubsan: nds32: left shift cannot be represented in type 'int'
Yet more. * nds32-dis.c (nds32_mask_opcode): Avoid signed overflow. (print_insn_nds32): Use uint64_t for "given" and "given1".
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/nds32-dis.c19
2 files changed, 15 insertions, 9 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 744d8f8bfa7..1e9945ee8d7 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,10 @@
2019-12-17 Alan Modra <amodra@gmail.com>
+ * nds32-dis.c (nds32_mask_opcode): Avoid signed overflow.
+ (print_insn_nds32): Use uint64_t for "given" and "given1".
+
+2019-12-17 Alan Modra <amodra@gmail.com>
+
* tic80-dis.c: Delete file.
* tic80-opc.c: Delete file.
* disassemble.c: Remove tic80 support.
diff --git a/opcodes/nds32-dis.c b/opcodes/nds32-dis.c
index 0e41399ef05..ac09e4d5432 100644
--- a/opcodes/nds32-dis.c
+++ b/opcodes/nds32-dis.c
@@ -877,7 +877,7 @@ nds32_mask_opcode (uint32_t insn)
}
return MASK_OP (insn, 0x1f << 20);
default:
- return (1 << 31);
+ return 1u << 31;
}
}
@@ -976,8 +976,8 @@ print_insn_nds32 (bfd_vma pc, disassemble_info *info)
int status;
bfd_byte buf[4];
bfd_byte buf_data[16];
- long long given;
- long long given1;
+ uint64_t given;
+ uint64_t given1;
uint32_t insn;
int n;
int last_symbol_index = -1;
@@ -1129,24 +1129,25 @@ print_insn_nds32 (bfd_vma pc, disassemble_info *info)
info->bytes_per_line = 4;
if (size == 16)
- info->fprintf_func (info->stream, ".qword\t0x%016llx%016llx",
+ info->fprintf_func (info->stream, ".qword\t0x%016" PRIx64 "%016" PRIx64,
given, given1);
else if (size == 8)
- info->fprintf_func (info->stream, ".dword\t0x%016llx", given);
+ info->fprintf_func (info->stream, ".dword\t0x%016" PRIx64, given);
else if (size == 4)
- info->fprintf_func (info->stream, ".word\t0x%08llx", given);
+ info->fprintf_func (info->stream, ".word\t0x%08" PRIx64, given);
else if (size == 2)
{
/* short */
if (mapping_type == MAP_DATA0)
- info->fprintf_func (info->stream, ".byte\t0x%02llx", given & 0xFF);
+ info->fprintf_func (info->stream, ".byte\t0x%02" PRIx64,
+ given & 0xFF);
else
- info->fprintf_func (info->stream, ".short\t0x%04llx", given);
+ info->fprintf_func (info->stream, ".short\t0x%04" PRIx64, given);
}
else
{
/* byte */
- info->fprintf_func (info->stream, ".byte\t0x%02llx", given);
+ info->fprintf_func (info->stream, ".byte\t0x%02" PRIx64, given);
}
return size;