[8/8] Use unsigned integer constant with left shifts.
Commit Message
This avoids undefined behavior.
gdb/ChangeLog:
* ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
left shifts.
---
gdb/ChangeLog | 5 +++++
gdb/ada-lang.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
@@ -1,5 +1,10 @@
2016-06-11 John Baldwin <jhb@FreeBSD.org>
+ * ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
+ left shifts.
+
+2016-06-11 John Baldwin <jhb@FreeBSD.org>
+
* v850-tdep.c (v850_use_struct_convention): Trim type length checks.
2016-06-11 John Baldwin <jhb@FreeBSD.org>
@@ -2486,7 +2486,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
accumSize += HOST_CHAR_BIT - unusedLS;
if (accumSize >= HOST_CHAR_BIT)
{
- unpacked[unpacked_idx] = accum & ~(~0L << HOST_CHAR_BIT);
+ unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
accumSize -= HOST_CHAR_BIT;
accum >>= HOST_CHAR_BIT;
unpacked_bytes_left -= 1;
@@ -2500,7 +2500,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
while (unpacked_bytes_left > 0)
{
accum |= sign << accumSize;
- unpacked[unpacked_idx] = accum & ~(~0L << HOST_CHAR_BIT);
+ unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
accumSize -= HOST_CHAR_BIT;
if (accumSize < 0)
accumSize = 0;