diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-06-06 22:58:50 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-06-06 22:58:50 +0000 |
commit | 67164852a7cc0923b857c84c515ad67969e81a67 (patch) | |
tree | aec4a77ec43431b393a064448f6c08ba6de81efd /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 00e7dffefba3ce82eeaf31c2d9ce7f0d41a59426 (diff) | |
download | bcm5719-llvm-67164852a7cc0923b857c84c515ad67969e81a67.tar.gz bcm5719-llvm-67164852a7cc0923b857c84c515ad67969e81a67.zip |
When doing arithmatic on vla pointer, make sure
to emit vla size to prevent an irgen crash.
// rdar://11485774
llvm-svn: 158117
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index e0265545be3..fa7b1368314 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/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; |