diff options
author | Alan Modra <amodra@gmail.com> | 2020-01-11 12:32:11 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-01-13 12:12:05 +1030 |
commit | 202e762b322444344827acbf98162fcb2910e0dd (patch) | |
tree | 16e2e65d75ba1e4fb0c66277c2955eb8fd2c322a /opcodes | |
parent | 7ef412cf72a197d68e532604cc1fa21351adc858 (diff) | |
download | binutils-202e762b322444344827acbf98162fcb2910e0dd.zip binutils-202e762b322444344827acbf98162fcb2910e0dd.tar.gz binutils-202e762b322444344827acbf98162fcb2910e0dd.tar.bz2 |
ubsan: fr30: left shift of negative value
cpu/
* fr30.cpu (f-disp9, f-disp10, f-s10, f-rel9, f-rel12): Don't
left shift signed values.
opcodes/
* fr30-ibld.c: Regenerate.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 4 | ||||
-rw-r--r-- | opcodes/fr30-ibld.c | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index e2e9b10..feeb7c5 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,9 @@ 2020-01-13 Alan Modra <amodra@gmail.com> + * fr30-ibld.c: Regenerate. + +2020-01-13 Alan Modra <amodra@gmail.com> + * xgate-dis.c (print_insn): Don't left shift signed value. (ripBits): Formatting, use 1u. diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c index 8f12e4c..ea4ea0a 100644 --- a/opcodes/fr30-ibld.c +++ b/opcodes/fr30-ibld.c @@ -831,7 +831,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd, { long value; length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 8, 16, total_length, pc, & value); - value = ((value) << (2)); + value = ((value) * (4)); fields->f_disp10 = value; } break; @@ -842,7 +842,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd, { long value; length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 8, 16, total_length, pc, & value); - value = ((value) << (1)); + value = ((value) * (2)); fields->f_disp9 = value; } break; @@ -867,7 +867,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd, { long value; length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 11, 16, total_length, pc, & value); - value = ((((value) << (1))) + (((pc) + (2)))); + value = ((((value) * (2))) + (((pc) + (2)))); fields->f_rel12 = value; } break; @@ -875,7 +875,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd, { long value; length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 8, 16, total_length, pc, & value); - value = ((((value) << (1))) + (((pc) + (2)))); + value = ((((value) * (2))) + (((pc) + (2)))); fields->f_rel9 = value; } break; @@ -905,7 +905,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC cd, { long value; length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 16, total_length, pc, & value); - value = ((value) << (2)); + value = ((value) * (4)); fields->f_s10 = value; } break; |