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 | 31f8649f839ff3e8238543a07ec0bc3ee1213e57 (patch) | |
tree | 3a30aff5ee69d50df3bd57f130108f145ae9a941 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 4f9d349e07df5b5d8037493a01d153a694d2eeb2 (diff) | |
download | bcm5719-llvm-31f8649f839ff3e8238543a07ec0bc3ee1213e57.tar.gz bcm5719-llvm-31f8649f839ff3e8238543a07ec0bc3ee1213e57.zip |
Follow Eli's advice and store the VLA size with the native size_t type. Fixes PR3491.
llvm-svn: 63879
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 898c1bfd80d..73d3e2103c1 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/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"); |