diff options
author | Alan Modra <amodra@gmail.com> | 2023-04-26 10:31:01 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-04-26 12:06:33 +0930 |
commit | b4617f790475aa8b23552c07fa0242b8e9ee9fab (patch) | |
tree | 1872ed830f0cf70f5e207bd3f30678c834158ab2 /gas/ChangeLog-9697 | |
parent | 4a8635cbecbd4eefa6dafdc4510014ad1755ddc3 (diff) | |
download | binutils-gdb-b4617f790475aa8b23552c07fa0242b8e9ee9fab.tar.gz |
i386-dis.c UB shift and other tidies
1) i386-dis.c:12055:11: runtime error: left shift of negative value -1
Bit twiddling is best done unsigned, due to UB on overflow of signed
expressions. Fix this by using bfd_vma rather than bfd_signed_vma
everywhere in i386-dis.c except print_displacement.
2) Return get32s and get16 value in a bfd_vma, reducing the need for
temp variables.
3) Introduce get16s and get8s functions to simplify the code.
4) With some optimisation options gcc-13 legitimately complains about
a fall-through in OP_I. Fix that. OP_I also doesn't need to use
"mask" which was wrong for w_mode anyway.
5) Masking with & 0xffffffff is better than casting to unsigned. We
don't know for sure that unsigned int is 32-bit.
6) We also don't know that unsigned char is 8 bits. Mask codep
accesses everywhere. I don't expect binutils will work on anything
other than an 8-bit char host, but if we are masking codep accesses in
some places we might as well be consistent. (Better would be to use
stdint.h types more in binutils.)
Diffstat (limited to 'gas/ChangeLog-9697')
0 files changed, 0 insertions, 0 deletions