aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-01-14 09:17:09 +1030
committerAlan Modra <amodra@gmail.com>2020-01-14 10:57:52 +1030
commitca1eaac0edd9f5f6b5708dcfd04e5b8deb6527f8 (patch)
tree6f2abf6d9d8d1e538ab66489901b7600da5a1d7e /opcodes
parentb959e62a55d33f2b35978a80648b48492e2153bc (diff)
downloadgdb-ca1eaac0edd9f5f6b5708dcfd04e5b8deb6527f8.zip
gdb-ca1eaac0edd9f5f6b5708dcfd04e5b8deb6527f8.tar.gz
gdb-ca1eaac0edd9f5f6b5708dcfd04e5b8deb6527f8.tar.bz2
ubsan: z8k: left shift cannot be represented in type 'int'
* z8k-dis.c (unpack_instr): Formatting. Cast unsigned short values to unsigned before shifting.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/z8k-dis.c16
2 files changed, 13 insertions, 8 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8f3f944..54619fa 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-14 Alan Modra <amodra@gmail.com>
+
+ * z8k-dis.c (unpack_instr): Formatting. Cast unsigned short
+ values to unsigned before shifting.
+
2020-01-13 Thomas Troeger <tstroege@gmx.de>
* arm-dis.c (print_insn_arm): Fill in insn info fields for control
diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c
index cb871de..ba9331f 100644
--- a/opcodes/z8k-dis.c
+++ b/opcodes/z8k-dis.c
@@ -369,8 +369,8 @@ unpack_instr (instr_data_s *instr_data, int is_segmented, disassemble_info *info
break;
case ARG_IMM32:
FETCH_DATA (info, nibl_count + 8);
- instr_long = (instr_data->words[nibl_count] << 16)
- | (instr_data->words[nibl_count + 4]);
+ instr_long = ((unsigned) instr_data->words[nibl_count] << 16
+ | instr_data->words[nibl_count + 4]);
instr_data->immediate = instr_long;
nibl_count += 7;
break;
@@ -402,17 +402,17 @@ unpack_instr (instr_data_s *instr_data, int is_segmented, disassemble_info *info
if (instr_nibl & 0x8)
{
FETCH_DATA (info, nibl_count + 8);
- instr_long = (instr_data->words[nibl_count] << 16)
- | (instr_data->words[nibl_count + 4]);
- instr_data->address = ((instr_word & 0x7f00) << 16)
- + (instr_long & 0xffff);
+ instr_long = ((unsigned) instr_data->words[nibl_count] << 16
+ | instr_data->words[nibl_count + 4]);
+ instr_data->address = ((instr_word & 0x7f00) << 16
+ | (instr_long & 0xffff));
nibl_count += 7;
seg_length = 2;
}
else
{
- instr_data->address = ((instr_word & 0x7f00) << 16)
- + (instr_word & 0x00ff);
+ instr_data->address = ((instr_word & 0x7f00) << 16
+ | (instr_word & 0x00ff));
nibl_count += 3;
}
}