From: Alan Modra Date: Thu, 2 Jan 2020 21:42:00 +0000 (+1030) Subject: ubsan: cr16: left shift cannot be represented in type 'int' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f57d4ecf51c2f420dae56dfb9fc525d1979ec7c;p=binutils-gdb.git ubsan: cr16: left shift cannot be represented in type 'int' * cr16-dis.c (cr16_match_opcode): Avoid shift left of signed value. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 514466ed635..d72dcec0426 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2020-01-04 Alan Modra + + * cr16-dis.c (cr16_match_opcode): Avoid shift left of signed value. + 2020-01-04 Alan Modra * crx-dis.c (match_opcode): Avoid shift left of signed value. diff --git a/opcodes/cr16-dis.c b/opcodes/cr16-dis.c index c40a07e2502..1be67b21181 100644 --- a/opcodes/cr16-dis.c +++ b/opcodes/cr16-dis.c @@ -319,8 +319,7 @@ cr16_match_opcode (void) { unsigned long mask; /* The instruction 'constant' opcode doesn't exceed 32 bits. */ - unsigned long doubleWord = (cr16_words[1] - + (cr16_words[0] << 16)) & 0xffffffff; + unsigned long doubleWord = cr16_words[1] + ((unsigned) cr16_words[0] << 16); /* Start searching from end of instruction table. */ instruction = &cr16_instruction[NUMOPCODES - 2];