ubsan: cr16: left shift cannot be represented in type 'int'
authorAlan Modra <amodra@gmail.com>
Tue, 10 Dec 2019 12:32:37 +0000 (23:02 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Dec 2019 01:08:04 +0000 (11:38 +1030)
commit0ef562a4b5da6bc1f16b2ea801b228acafd033d8
tree4d87c16e9066d5947b56c349141008c063a76b6f
parent2fd2b153a3819d3ab6b9c4cf06943d498187714c
ubsan: cr16: left shift cannot be represented in type 'int'

This was:
  unsigned long mask = SBM (instruction->match_bits);
with
  #define SBM(offs)  ((((1 << (32 - offs)) -1) << (offs)))

Well, there are a couple of problems.  Firstly, the expression uses
int values (1 rather than 1u or 1ul) resulting in the ubsan error, and
secondly, a zero offs will result in a 32-bit shift which is undefined
if ints are only 32 bits.

* cr16-dis.c (EXTRACT, SBM): Rewrite.
(cr16_match_opcode): Delete duplicate bcond test.
opcodes/ChangeLog
opcodes/cr16-dis.c
This page took 0.025196 seconds and 4 git commands to generate.