Add parens around constant calls to getelemptr to properly associate the reference
authorNick Hildenbrandt <hldnbrnd@uiuc.edu>
Thu, 3 Oct 2002 20:47:24 +0000 (20:47 +0000)
committerNick Hildenbrandt <hldnbrnd@uiuc.edu>
Thu, 3 Oct 2002 20:47:24 +0000 (20:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4032 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 645832cd3595e13fe1d456d2a312020a65fc50c2..bc2106d78fec9333b90776d91442bbf160cc4774 100644 (file)
@@ -337,10 +337,10 @@ void CWriter::printConstant(Constant *CPV) {
       return;
 
     case Instruction::GetElementPtr:
-      Out << "&(";
+      Out << "(&(";
       printIndexingExpression(CPV->getOperand(0),
                               CPV->op_begin()+1, CPV->op_end());
-      Out << ")";
+      Out << "))";
       return;
     case Instruction::Add:
       Out << "(";
index 645832cd3595e13fe1d456d2a312020a65fc50c2..bc2106d78fec9333b90776d91442bbf160cc4774 100644 (file)
@@ -337,10 +337,10 @@ void CWriter::printConstant(Constant *CPV) {
       return;
 
     case Instruction::GetElementPtr:
-      Out << "&(";
+      Out << "(&(";
       printIndexingExpression(CPV->getOperand(0),
                               CPV->op_begin()+1, CPV->op_end());
-      Out << ")";
+      Out << "))";
       return;
     case Instruction::Add:
       Out << "(";