diff options
author | Alan Modra <amodra@gmail.com> | 2019-12-11 13:11:07 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-12-11 13:33:26 +1030 |
commit | 5afa80e9a8e6585eeaac44ca51be9c6b2471bf80 (patch) | |
tree | 7ae2ac727c99a3a237999df7d7fd3b84f2ffa652 /opcodes | |
parent | 5c05618a0a1f94565001a19da28595ce1dc537f8 (diff) | |
download | gdb-5afa80e9a8e6585eeaac44ca51be9c6b2471bf80.zip gdb-5afa80e9a8e6585eeaac44ca51be9c6b2471bf80.tar.gz gdb-5afa80e9a8e6585eeaac44ca51be9c6b2471bf80.tar.bz2 |
Re: ubsan: ns32k: left shift cannot be represented in type
* ns32k-dis.c (sign_extend): Correct last patch.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 4 | ||||
-rw-r--r-- | opcodes/ns32k-dis.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index c1fce7f..5345dfb 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,9 @@ 2019-12-11 Alan Modra <amodra@gmail.com> + * ns32k-dis.c (sign_extend): Correct last patch. + +2019-12-11 Alan Modra <amodra@gmail.com> + * vax-dis.c (NEXTLONG): Avoid signed overflow. 2019-12-11 Alan Modra <amodra@gmail.com> diff --git a/opcodes/ns32k-dis.c b/opcodes/ns32k-dis.c index 5e6f096..e43fff7 100644 --- a/opcodes/ns32k-dis.c +++ b/opcodes/ns32k-dis.c @@ -327,8 +327,8 @@ bit_copy (bfd_byte *buffer, int offset, int count, char *to) static int sign_extend (unsigned int value, unsigned int bits) { - unsigned int sign = 1u << bits; - return ((value & (sign - 1)) ^ sign) - sign; + unsigned int sign = 1u << (bits - 1); + return ((value & (sign + sign - 1)) ^ sign) - sign; } static void |