ubsan: moxie: left shift of negative value
authorAlan Modra <amodra@gmail.com>
Tue, 10 Dec 2019 21:56:58 +0000 (08:26 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Dec 2019 01:10:00 +0000 (11:40 +1030)
* moxie-dis.c (INST2OFFSET): Don't sign extend using shifts.

opcodes/ChangeLog
opcodes/moxie-dis.c

index ffe57a451489d9e8afc130fd983d85d92edf1965..60dfe76ef1238e9f05bb5cd0404e3e6eea8b705d 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-11  Alan Modra  <amodra@gmail.com>
+
+       * moxie-dis.c (INST2OFFSET): Don't sign extend using shifts.
+
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
        * m68k-dis.c (COERCE32): Cast value first.
index 3097fa09778569a9199fb1feaa0d5f5c0d1d82fd..cbfcf958806831bcd32b85eca1fdb9f891e6e65b 100644 (file)
@@ -33,7 +33,7 @@ static void *stream;
 /* Macros to extract operands from the instruction word.  */
 #define OP_A(i) ((i >> 4) & 0xf)
 #define OP_B(i) (i & 0xf)
-#define INST2OFFSET(o) ((((signed short)((o & ((1<<10)-1))<<6))>>6)<<1)
+#define INST2OFFSET(o) (((((o) & 0x3ff) ^ 0x200) - 0x200) << 1)
 
 static const char * reg_names[16] =
   { "$fp", "$sp", "$r0", "$r1", "$r2", "$r3", "$r4", "$r5",
This page took 0.026305 seconds and 4 git commands to generate.