Re: ubsan: ns32k: left shift cannot be represented in type
* ns32k-dis.c (sign_extend): Correct last patch.
This commit is contained in:
parent
5c05618a0a
commit
5afa80e9a8
2 changed files with 6 additions and 2 deletions
|
@ -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>
|
2019-12-11 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* vax-dis.c (NEXTLONG): Avoid signed overflow.
|
* vax-dis.c (NEXTLONG): Avoid signed overflow.
|
||||||
|
|
|
@ -327,8 +327,8 @@ bit_copy (bfd_byte *buffer, int offset, int count, char *to)
|
||||||
static int
|
static int
|
||||||
sign_extend (unsigned int value, unsigned int bits)
|
sign_extend (unsigned int value, unsigned int bits)
|
||||||
{
|
{
|
||||||
unsigned int sign = 1u << bits;
|
unsigned int sign = 1u << (bits - 1);
|
||||||
return ((value & (sign - 1)) ^ sign) - sign;
|
return ((value & (sign + sign - 1)) ^ sign) - sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue