Discussion:
[committed, nios2] fix incorrect disassembly of signed fields
Sandra Loosemore
2018-09-23 19:54:34 UTC
Permalink
I recently spotted some failures in the gas testsuite when running nios2
tests on x86_64-w64-mingw32 host for the first time, which turned out to
be a disassembler bug rather than an assembler bug. This host has a
32-bit long type and 64-bit bfd_vma type, and some sloppy type
conversions from int to unsigned long and then to bfd_vma in the
disassembler were causing the extension of signed instruction fields
from 32 to 64 bits to happen as an unsigned conversion. This
particularly affected printing of branch target addresses -- in some
cases it was printing the wrong symbol, even.

I've checked in the attached patch to clean this up. I'm now explicitly
using signed temporaries of the appropriate type (long or
bfd_signed_vma) instead of unsigned long for the intermediate value, and
I changed the casts on the bit field extraction to int32_t to make the
size as well as the signedness more obvious.

-Sandra

Loading...