aboutsummaryrefslogtreecommitdiff
path: root/opcodes/hppa-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-20 12:14:19 +1030
committerAlan Modra <amodra@gmail.com>2019-12-20 13:36:06 +1030
commit15d2859fddcb769e59b906f9443c85afdd5d7380 (patch)
tree3d1aa7d06813d4fd6ada5c0fc6152c3e1176e420 /opcodes/hppa-dis.c
parent000fe1a756e707624d387eeacbaa959a01f0d040 (diff)
downloadgdb-15d2859fddcb769e59b906f9443c85afdd5d7380.zip
gdb-15d2859fddcb769e59b906f9443c85afdd5d7380.tar.gz
gdb-15d2859fddcb769e59b906f9443c85afdd5d7380.tar.bz2
ubsan: hppa: left shift of negative value
bfd/ * libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward declaration. Move ATTRIBUTE_UNUSED to definition. (sign_extend, low_sign_extend, sign_unext, low_sign_unext), (re_assemble_3, re_assemble_12, re_assemble_14, re_assemble_16), (re_assemble_17, re_assemble_21, re_assemble_22): Likewise. Make args and return value unsigned. Use unsigned variables. (hppa_rebuild_insn): Similarly. opcodes/ * hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use unsigned variables.
Diffstat (limited to 'opcodes/hppa-dis.c')
-rw-r--r--opcodes/hppa-dis.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/opcodes/hppa-dis.c b/opcodes/hppa-dis.c
index 1d85d78..9844332 100644
--- a/opcodes/hppa-dis.c
+++ b/opcodes/hppa-dis.c
@@ -289,7 +289,7 @@ extract_14 (unsigned word)
static int
extract_16 (unsigned word)
{
- int m15, m0, m1;
+ unsigned m15, m0, m1;
m0 = GET_BIT (word, 16);
m1 = GET_BIT (word, 17);
@@ -304,7 +304,7 @@ extract_16 (unsigned word)
static int
extract_21 (unsigned word)
{
- int val;
+ unsigned val;
word &= MASK_21;
word <<= 11;
@@ -1098,9 +1098,9 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
case '#':
{
- int sign = GET_FIELD (insn, 31, 31);
- int imm10 = GET_FIELD (insn, 18, 27);
- int disp;
+ unsigned sign = GET_FIELD (insn, 31, 31);
+ unsigned imm10 = GET_FIELD (insn, 18, 27);
+ unsigned disp;
if (sign)
disp = (-1U << 10) | imm10;
@@ -1114,9 +1114,9 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
case 'K':
case 'd':
{
- int sign = GET_FIELD (insn, 31, 31);
- int imm11 = GET_FIELD (insn, 18, 28);
- int disp;
+ unsigned sign = GET_FIELD (insn, 31, 31);
+ unsigned imm11 = GET_FIELD (insn, 18, 28);
+ unsigned disp;
if (sign)
disp = (-1U << 11) | imm11;