Re: ubsan: ns32k: left shift cannot be represented in type

* ns32k-dis.c (sign_extend): Correct last patch.
This commit is contained in:
Alan Modra 2019-12-11 13:11:07 +10:30
parent 5c05618a0a
commit 5afa80e9a8
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
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.

View File

@ -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