[llvm-commits] [llvm] r60239 - /llvm/trunk/include/llvm/ADT/PointerIntPair.h

Torok Edwin edwintorok at gmail.com
Sat Nov 29 00:52:45 PST 2008


Author: edwin
Date: Sat Nov 29 02:52:45 2008
New Revision: 60239

URL: http://llvm.org/viewvc/llvm-project?rev=60239&view=rev
Log:
protect against negative values that would exceed allowed bit width

Modified:
    llvm/trunk/include/llvm/ADT/PointerIntPair.h

Modified: llvm/trunk/include/llvm/ADT/PointerIntPair.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerIntPair.h?rev=60239&r1=60238&r2=60239&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerIntPair.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerIntPair.h Sat Nov 29 02:52:45 2008
@@ -53,7 +53,7 @@
   }
   
   void setInt(IntType Int) {
-    assert(Int < (1 << IntBits) && "Integer too large for field");
+    assert(unsigned(Int) < (1 << IntBits) && "Integer too large for field");
     Value = reinterpret_cast<intptr_t>(getPointer()) | (intptr_t)Int;
   }
   





More information about the llvm-commits mailing list