This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix undefined compilation behaviour shifting a value into the sign bit of a signed integer.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Feb 2016 10:42:36 -0000
- Subject: [binutils-gdb] Fix undefined compilation behaviour shifting a value into the sign bit of a signed integer.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d8c823c8b62b4f0fc4747eb9e4e29739add34c17
commit d8c823c8b62b4f0fc4747eb9e4e29739add34c17
Author: Michael McConville <mmcco@mykolab.com>
Date: Mon Feb 1 10:41:32 2016 +0000
Fix undefined compilation behaviour shifting a value into the sign bit of a signed integer.
* cgen-dis.c (count_decodable_bits): Use unsigned value for mask
test bit.
Diff:
---
opcodes/ChangeLog | 5 +++++
opcodes/cgen-dis.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 130a4a7..505b5e7 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-01 Michael McConville <mmcco@mykolab.com>
+
+ * cgen-dis.c (count_decodable_bits): Use unsigned value for mask
+ test bit.
+
2016-01-25 Renlin Li <renlin.li@arm.com>
* arm-dis.c (mapping_symbol_for_insn): New function.
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index f9f7fb2..2d0f701 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -40,7 +40,8 @@ count_decodable_bits (const CGEN_INSN *insn)
{
unsigned mask = CGEN_INSN_BASE_MASK (insn);
int bits = 0;
- int m;
+ unsigned m;
+
for (m = 1; m != 0; m <<= 1)
{
if (mask & m)