This is the mail archive of the binutils-cvs@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]

[binutils-gdb] Fix an undefined 32-bit right shift by replacing it with two 16-bit right shifts.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=65164438aaf163aee0de40bcfab87dfd58f47b6b

commit 65164438aaf163aee0de40bcfab87dfd58f47b6b
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Mar 6 09:46:15 2015 +0000

    Fix an undefined 32-bit right shift by replacing it with two 16-bit right shifts.
    
    	PR binutils/17765
    	* elflink.c (put_value): Like previous delta, but for the 32-bit
    	case.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/elflink.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6810f6b..a370597 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-06  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/17765
+	* elflink.c (put_value): Like previous delta, but for the 32-bit
+	case.
+
 2015-03-05  Nick Clifton  <nickc@redhat.com>
 
 	PR binutils/17765
diff --git a/bfd/elflink.c b/bfd/elflink.c
index b285e76..f93293b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -7807,7 +7807,9 @@ put_value (bfd_vma size,
 	  break;
 	case 4:
 	  bfd_put_32 (input_bfd, x, location);
-	  x >>= 32;
+	  /* Computed this way because x >>= 32 is undefined if x is a 32-bit value.  */
+	  x >>= 16;
+	  x >>= 16;
 	  break;
 #ifdef BFD64
 	case 8:


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