aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index e0265545be..fa7b136831 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1970,6 +1970,9 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF,
QualType elementType = pointerType->getPointeeType();
if (const VariableArrayType *vla
= CGF.getContext().getAsVariableArrayType(elementType)) {
+ // arithmatic on VLA pointer - make sure to emit the VLA size.
+ CGF.EmitVariablyModifiedType(elementType);
+
// The element count here is the total number of non-VLA elements.
llvm::Value *numElements = CGF.getVLASize(vla).first;