ubsan: xtensa: left shift cannot be represented in type 'int'
authorAlan Modra <amodra@gmail.com>
Fri, 20 Dec 2019 02:14:33 +0000 (12:44 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 20 Dec 2019 03:06:06 +0000 (13:36 +1030)
* xtensa-isa.c (xtensa_insnbuf_from_chars): Avoid signed overflow.

bfd/ChangeLog
bfd/xtensa-isa.c

index 14aebd93f71b41a41ca0730593b604581c46d98a..40f4b663642506e98d304b86782272567b0a1848 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-20  Alan Modra  <amodra@gmail.com>
+
+       * xtensa-isa.c (xtensa_insnbuf_from_chars): Avoid signed overflow.
+
 2019-12-20  Alan Modra  <amodra@gmail.com>
 
        * libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward
index 172de6f41e9b8a535abd6e107de712db33bbe97f..9ddc6cd84442e26aad338401e0553488ee6352b8 100644 (file)
@@ -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;
     }
 }