diff options
author | John Baldwin <jhb@FreeBSD.org> | 2016-06-11 13:18:15 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2016-07-06 06:09:19 -0700 |
commit | db297a6501dc44c10bff096eddcc358b48810aad (patch) | |
tree | 7d4c4e3c4d101b53028c633f71a45ee955cd75e4 /gdb/ada-lang.c | |
parent | 9ca107148e888a7f7aaf3582569708684bd04690 (diff) | |
download | gdb-db297a6501dc44c10bff096eddcc358b48810aad.zip gdb-db297a6501dc44c10bff096eddcc358b48810aad.tar.gz gdb-db297a6501dc44c10bff096eddcc358b48810aad.tar.bz2 |
Use unsigned integer constant with left shifts.
This avoids undefined behavior.
gdb/ChangeLog:
* ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
left shifts.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index b22b7ac..05bfd7b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2525,7 +2525,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; @@ -2539,7 +2539,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; |