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

John Criswell criswell at cs.uiuc.edu
Thu Jul 14 12:41:34 PDT 2005



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.241 -> 1.242
---
Log message:

Fixed PR#596:
Add parenthesis around the value being negated; that way, if the value
begins with a minus sign (e.g. negative integer), we won't generate a
C predecrement operator by mistake.


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

 Writer.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.241 llvm/lib/Target/CBackend/Writer.cpp:1.242
--- llvm/lib/Target/CBackend/Writer.cpp:1.241	Fri Jun 24 21:48:36 2005
+++ llvm/lib/Target/CBackend/Writer.cpp	Thu Jul 14 14:41:16 2005
@@ -1361,9 +1361,9 @@
   // If this is a negation operation, print it out as such.  For FP, we don't
   // want to print "-0.0 - X".
   if (BinaryOperator::isNeg(&I)) {
-    Out << "-";
+    Out << "-(";
     writeOperand(BinaryOperator::getNegArgument(cast<BinaryOperator>(&I)));
-
+    Out << ")";
   } else {
     writeOperand(I.getOperand(0));
 






More information about the llvm-commits mailing list