ubsan: crx: left shift cannot be represented in type 'int'

Message ID 20200104085150.GQ16749@bubble.grove.modra.org
State New
Headers show
Series
  • ubsan: crx: left shift cannot be represented in type 'int'
Related show

Commit Message

Alan Modra Jan. 4, 2020, 8:51 a.m.
* crx-dis.c (match_opcode): Avoid shift left of signed value.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c
index 18b6c6d9e6..011cd682fc 100644
--- a/opcodes/crx-dis.c
+++ b/opcodes/crx-dis.c
@@ -337,7 +337,7 @@  match_opcode (void)
   unsigned int mask;
 
   /* The instruction 'constant' opcode doewsn't exceed 32 bits.  */
-  unsigned int doubleWord = (words[1] + (words[0] << 16)) & 0xffffffff;
+  unsigned int doubleWord = words[1] + ((unsigned) words[0] << 16);
 
   /* Start searching from end of instruction table.  */
   instruction = &crx_instruction[NUMOPCODES - 2];