From: Dominik Vogt Date: Mon, 9 Nov 2015 16:12:56 +0000 (+0100) Subject: binutils: Fix left shift of negative value. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c4e0beacd71d4a65cfbe27466ae3d0403c39ead5;p=binutils-gdb.git binutils: Fix left shift of negative value. This patch fixes all occurences of left-shifting negative constants in C code which is undefined by the C standard. binutils/ChangeLog: * dwarf.c (read_leb128): Fix left shift of negative value. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 8779082c649..bcbad22fdf3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2015-11-09 Dominik Vogt + + * dwarf.c (read_leb128): Fix left shift of negative value. + 2015-11-03 Alan Modra * readelf (process_version_sections): Check DT_VERNEED and diff --git a/binutils/dwarf.c b/binutils/dwarf.c index c14049ac8d2..9f1baea8312 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -292,7 +292,7 @@ read_leb128 (unsigned char *data, *length_return = num_read; if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40)) - result |= (dwarf_vma) -1 << shift; + result |= -((dwarf_vma) 1 << shift); return result; }