This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/7] Fix invalid left shift of negative value.


On Fri, Oct 30, 2015 at 03:38:15PM +0100, Dominik Vogt wrote:
> The following series of patches fixes all occurences of
> left-shifting negative constants in C code which is undefined by
> the C standard.  The patches have been tested on s390x, covering
> only a small subset of the changes.

Changes in binutils/.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

Attachment: 0002-ChangeLog
Description: Text document

>From 952aa88a5d93deb11f4072efcb042910211b09ee Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Fri, 30 Oct 2015 15:12:27 +0100
Subject: [PATCH 2/7] binutils: Fix left shift of negative value.

---
 binutils/dwarf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index c14049a..9f1baea 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;
 }
-- 
2.3.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]