This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ubsan: csky: left shift cannot be represented in type 'int'
* csky-dis.c (csky_chars_to_number): Remove abort and unnecessary
mask.
diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index af830f3651..d7ffb13b5f 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -134,17 +134,15 @@ csky_get_mask (struct csky_opcode_info const *pinfo)
static unsigned int
csky_chars_to_number (unsigned char * buf, int n)
{
- if (n <= 0)
- abort ();
int i;
unsigned int val = 0;
if (dis_info.info->endian == BFD_ENDIAN_BIG)
for (i = 0; i < n; i++)
- val = val << 8 | (buf[i] & 0xff);
+ val = val << 8 | buf[i];
else
for (i = n - 1; i >= 0; i--)
- val = val << 8 | (buf[i] & 0xff);
+ val = val << 8 | buf[i];
return val;
}
--
Alan Modra
Australia Development Lab, IBM