ubsan: csky: left shift cannot be represented in type 'int'
Michael Matz
matz@suse.de
Wed Dec 11 14:12:00 GMT 2019
Hi,
On Wed, 11 Dec 2019, Alan Modra wrote:
> if (dis_info.info->endian == BFD_ENDIAN_BIG)
> - while (n--)
> - val |= buf[n] << (n*8);
> - else
> for (i = 0; i < n; i++)
> - val |= buf[i] << (i*8);
> + val = val << 8 | (buf[i] & 0xff);
> + else
> + for (i = n - 1; i >= 0; i--)
> + val = val << 8 | (buf[i] & 0xff);
But the '& 0xff' is really a no-op here, as you said: buf[i] is unsigned
char.
Ciao,
Michael.
More information about the Binutils
mailing list