[cfe-commits] [PATCH 1/2] Avoid unsigned Compare to int
David Greene
dag at cray.com
Tue Jan 8 13:21:38 PST 2013
Cast arithmetic results to avoid comparison of an unsigned to an int.
---
llvm/tools/clang/lib/CodeGen/CGExpr.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/llvm/tools/clang/lib/CodeGen/CGExpr.cpp b/llvm/tools/clang/lib/CodeGen/CGExpr.cpp
index 461126e..faffcae 100644
--- a/llvm/tools/clang/lib/CodeGen/CGExpr.cpp
+++ b/llvm/tools/clang/lib/CodeGen/CGExpr.cpp
@@ -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");
--
1.7.8.4
More information about the cfe-commits
mailing list