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 build failure in gold due to signed vs. unsigned comparisons.


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

commit 2bf48941a7987cd1abedfb4ddbb45b75201381ad
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Sat Feb 6 09:53:58 2016 -0800

    Fix build failure in gold due to signed vs. unsigned comparisons.
    
    	* reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
    	comparison.
    	(Bits::has_unsigned_overflow): Likewise.

Diff:
---
 gold/ChangeLog | 6 ++++++
 gold/reloc.h   | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index c883077..1b36374 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-06  Cary Coutant  <ccoutant@gmail.com>
+
+	* reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
+	comparison.
+	(Bits::has_unsigned_overflow): Likewise.
+
 2016-02-06  Marcin KoÅ?cielnicki  <koriakin@0x04.net>
 
 	* i386.cc (Target_i386::is_call_to_non_split): Add view and view_size
diff --git a/gold/reloc.h b/gold/reloc.h
index 4f1e753..fce7313 100644
--- a/gold/reloc.h
+++ b/gold/reloc.h
@@ -1015,7 +1015,7 @@ class Bits
     gold_assert(bits > 0 && bits <= 32);
     if (bits == 32)
       return false;
-    int32_t max = static_cast<int32_t>((1U << bits) - 1);
+    uint32_t max = static_cast<int32_t>((1U << bits) - 1);
     return val > max;
   }
 
@@ -1081,7 +1081,7 @@ class Bits
     gold_assert(bits > 0 && bits <= 64);
     if (bits == 64)
       return false;
-    int64_t max = static_cast<int64_t>((static_cast<uint64_t>(1) << bits) - 1);
+    uint64_t max = static_cast<int64_t>((static_cast<uint64_t>(1) << bits) - 1);
     return val > max;
   }


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