diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2012-06-07 17:07:15 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-06-07 17:07:15 +0000 |
| commit | 2ccc0f9c23e6b948a4db6ffe46aefa098e1a2956 (patch) | |
| tree | 07bf3ba5b2deea43d7d36fc84e1d6ba0932dc760 /lib/CodeGen/CGExpr.cpp | |
| parent | b8e54cd26cc71075456a74be054a95fa1f2e28ad (diff) | |
When emitting compund literal of vla pointer elements, make
sure to emit vla size to prevent an irgen crash.
// rdar://11485774
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158153 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | lib/CodeGen/CGExpr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 190855d3a0..5d1890635e 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2114,7 +2114,11 @@ LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr *E){ llvm::Value *GlobalPtr = CGM.GetAddrOfConstantCompoundLiteral(E); return MakeAddrLValue(GlobalPtr, E->getType()); } - + if (const PointerType *pointerType = E->getType()->getAs<PointerType>()) + if (pointerType->getPointeeType()->isVariableArrayType()) + // make sure to emit the VLA size. + EmitVariablyModifiedType(pointerType->getPointeeType()); + llvm::Value *DeclPtr = CreateMemTemp(E->getType(), ".compoundliteral"); const Expr *InitExpr = E->getInitializer(); LValue Result = MakeAddrLValue(DeclPtr, E->getType()); |
