aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 294f97529b..bc085241d0 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -1238,6 +1238,7 @@ void CWriter::writeOperandWithCast(Value* Operand, unsigned Opcode) {
shouldCast = true;
castIsSigned = false;
break;
+ case Instruction::GetElementPtr:
case Instruction::AShr:
case Instruction::SDiv:
case Instruction::SRem: // Cast to signed first
@@ -2859,7 +2860,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
} else {
Out << '[';
- writeOperand(I.getOperand());
+ writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
Out << ']';
}
}