Shifting into and out of the sign bit of an integer is undefined, and
this loop unconditionally does both. The below patch should fix it. My
analysis here applies:

https://marc.info/?l=openbsd-tech&m=145377854103866&w=2

Thanks for your time,
Michael


diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index f9f7fb2..296e99b 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -40,7 +40,7 @@ count_decodable_bits (const CGEN_INSN *insn)
 {
   unsigned mask = CGEN_INSN_BASE_MASK (insn);
   int bits = 0;
-  int m;
+  unsigned int m;
   for (m = 1; m != 0; m <<= 1)
     {
       if (mask & m)

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to