[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Nov 30 13:34:13 PST 2004



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.209 -> 1.210
---
Log message:

Do not let GCC emit a warning for INT64_MIN


---
Diffs of the changes:  (+5 -2)

Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.209 llvm/lib/Target/CBackend/Writer.cpp:1.210
--- llvm/lib/Target/CBackend/Writer.cpp:1.209	Tue Nov 30 15:27:01 2004
+++ llvm/lib/Target/CBackend/Writer.cpp	Tue Nov 30 15:33:58 2004
@@ -536,13 +536,16 @@
     Out << cast<ConstantSInt>(CPV)->getValue(); break;
   case Type::IntTyID:
     if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
-      Out << "((int)0x80000000)";   // Handle MININT specially to avoid warning
+      Out << "((int)0x80000000U)";   // Handle MININT specially to avoid warning
     else
       Out << cast<ConstantSInt>(CPV)->getValue();
     break;
 
   case Type::LongTyID:
-    Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;
+    if (cast<ConstantSInt>(CPV)->isMinValue())
+      Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)";
+    else
+      Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;
 
   case Type::UByteTyID:
   case Type::UShortTyID:






More information about the llvm-commits mailing list