Calculating data length to disassemble defaults to 4, but stop_vma is set to the next symbol so that the disassembler will not read beyond it. This causes an "Address out of bounds" error if the next symbol is less than 4 bytes away from the data to be disassembled. opcodes/ChangeLog: * riscv-dis.c (riscv_data_length): Do not go beyond stop_vma. gas/ChangeLog: * testsuite/gas/riscv/mapping-dis.d: Updated and added new testcase. * testsuite/gas/riscv/mapping-symbols.d: Likewise. * testsuite/gas/riscv/mapping.s: Added new testcase. --- gas/testsuite/gas/riscv/mapping-dis.d | 9 +++++++++ gas/testsuite/gas/riscv/mapping-symbols.d | 4 ++++ gas/testsuite/gas/riscv/mapping.s | 6 ++++++ opcodes/riscv-dis.c | 4 +++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gas/testsuite/gas/riscv/mapping-dis.d b/gas/testsuite/gas/riscv/mapping-dis.d index b1a26fbd151..5c908d52ec6 100644 --- a/gas/testsuite/gas/riscv/mapping-dis.d +++ b/gas/testsuite/gas/riscv/mapping-dis.d @@ -26,6 +26,15 @@ Disassembly of section .text.data: [ ]+[0-9a-f]+:[ ]+4509[ ]+li[ ]+a0,2 [ ]+[0-9a-f]+:[ ]+05000302[ ]+.word[ ]+0x05000302 +Disassembly of section .text.data.label: + +0+000 : +[ ]+[0-9a-f]+:[ ]+4505[ ]+li[ ]+a0,1 +[ ]+[0-9a-f]+:[ ]+0003[ ]+.short[ ]+0x0003 + +0+004