diff options
author | Anders Carlsson <andersca@mac.com> | 2009-02-05 19:43:10 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-02-05 19:43:10 +0000 |
commit | 96f214776c0f69069fee4d67557c8c7f416009a8 (patch) | |
tree | 68b462fe2367ffdd3d9d9cc7da9c48bbdc260265 /lib/CodeGen/CGDecl.cpp | |
parent | 1a6b3686bf5671075c5b217fcfc1840cb0aae172 (diff) |
Follow Eli's advice and store the VLA size with the native size_t type. Fixes PR3491.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63879 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 898c1bfd80..73d3e2103c 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -197,6 +197,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { llvm::Value *VLASize = EmitVLASize(Ty); + // Downcast the VLA size expression + VLASize = Builder.CreateIntCast(VLASize, llvm::Type::Int32Ty, false, "tmp"); + // Allocate memory for the array. llvm::Value *VLA = Builder.CreateAlloca(llvm::Type::Int8Ty, VLASize, "vla"); DeclPtr = Builder.CreateBitCast(VLA, LElemPtrTy, "tmp"); |