From: Alan Modra Date: Fri, 20 Dec 2019 02:14:33 +0000 (+1030) Subject: ubsan: xtensa: left shift cannot be represented in type 'int' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e76832f125f6f005ddf3c75b7be675272568b01e;p=binutils-gdb.git ubsan: xtensa: left shift cannot be represented in type 'int' * xtensa-isa.c (xtensa_insnbuf_from_chars): Avoid signed overflow. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 14aebd93f71..40f4b663642 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2019-12-20 Alan Modra + + * xtensa-isa.c (xtensa_insnbuf_from_chars): Avoid signed overflow. + 2019-12-20 Alan Modra * libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c index 172de6f41e9..9ddc6cd8444 100644 --- a/bfd/xtensa-isa.c +++ b/bfd/xtensa-isa.c @@ -223,7 +223,7 @@ xtensa_insnbuf_from_chars (xtensa_isa isa, int word_inx = byte_to_word_index (i); int bit_inx = byte_to_bit_index (i); - insn[word_inx] |= (*cp & 0xff) << bit_inx; + insn[word_inx] |= (unsigned) (*cp & 0xff) << bit_inx; } }