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)
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.


No differences found
This page took 0.028318 seconds and 4 git commands to generate.