]> granicus.if.org Git - clang/commitdiff
Avoid unsigned Compare to int
authorDavid Greene <greened@obbligato.org>
Tue, 15 Jan 2013 23:13:47 +0000 (23:13 +0000)
committerDavid Greene <greened@obbligato.org>
Tue, 15 Jan 2013 23:13:47 +0000 (23:13 +0000)
Cast arithmetic results to avoid comparison of an unsigned to an int.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172570 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index dd248e1900c745c072283387b278d2c74b39fda5..85adf359615677cf28eab192e9d53b0aa5f66a0e 100644 (file)
@@ -1191,7 +1191,7 @@ RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV) {
   cast<llvm::LoadInst>(Val)->setAlignment(Info.StorageAlignment);
 
   if (Info.IsSigned) {
-    assert((Info.Offset + Info.Size) <= Info.StorageSize);
+    assert(static_cast<unsigned>(Info.Offset + Info.Size) <= Info.StorageSize);
     unsigned HighBits = Info.StorageSize - Info.Offset - Info.Size;
     if (HighBits)
       Val = Builder.CreateShl(Val, HighBits, "bf.shl");