protect against negative values that would exceed allowed bit width
authorTorok Edwin <edwintorok@gmail.com>
Sat, 29 Nov 2008 08:52:45 +0000 (08:52 +0000)
committerTorok Edwin <edwintorok@gmail.com>
Sat, 29 Nov 2008 08:52:45 +0000 (08:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60239 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/PointerIntPair.h

index 4c4bb7dd081f89b65be532f080018ec218abbb96..5a9425457ddde1ec6c4e9a297192e4c29e8342aa 100644 (file)
@@ -53,7 +53,7 @@ public:
   }
   
   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;
   }