From d2eb386c16c7b786fcce6acc9563722e51fe5fca Mon Sep 17 00:00:00 2001 From: Nick Hildenbrandt Date: Thu, 3 Oct 2002 20:47:24 +0000 Subject: [PATCH] Add parens around constant calls to getelemptr to properly associate the reference git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4032 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 4 ++-- lib/Target/CBackend/Writer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 645832cd359..bc2106d78fe 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -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 << "("; diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 645832cd359..bc2106d78fe 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -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 << "(";