ubsan: bfin-dis.c:160 shift exponent 32 is too large

Alan Modra amodra@gmail.com
Wed Sep 2 08:42:57 GMT 2020
	* bfin-dis.c (MASKBITS): Use SIGNBIT.

diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index 4f66f12e3c..3eb6087a3c 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -34,7 +34,7 @@
 typedef long TIword;
 
 #define SIGNBIT(bits)       (1ul << ((bits) - 1))
-#define MASKBITS(val, bits) ((val) & ((1ul << (bits)) - 1))
+#define MASKBITS(val, bits) ((val) & ((SIGNBIT (bits) << 1) - 1))
 #define SIGNEXTEND(v, n)    ((MASKBITS (v, n) ^ SIGNBIT (n)) - SIGNBIT (n))
 
 #include "disassemble.h"
-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list