summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-09-14 18:57:08 +0000
committerJohn McCall <rjmccall@apple.com>2015-09-14 18:57:08 +0000
commitf0f0b7a0eb7607129c50fcbccd228c69f3451c79 (patch)
treed83355d2c5d612bb0ac8d265f1e60241246d942b /clang/lib/CodeGen
parenta5f384487a7300251dd3d9331f152ec5e563de73 (diff)
downloadbcm5719-llvm-f0f0b7a0eb7607129c50fcbccd228c69f3451c79.tar.gz
bcm5719-llvm-f0f0b7a0eb7607129c50fcbccd228c69f3451c79.zip
Fix a nasty bug with the partial destruction of nested arrays;
it escaped notice because it's only used for heterogeneous initialization. rdar://21397946 llvm-svn: 247597
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 587281c86e9..6570785972d 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -1535,9 +1535,9 @@ static void emitPartialArrayDestroy(CodeGenFunction &CGF,
}
if (arrayDepth) {
- llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, arrayDepth+1);
+ llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, 0);
- SmallVector<llvm::Value*,4> gepIndices(arrayDepth, zero);
+ SmallVector<llvm::Value*,4> gepIndices(arrayDepth+1, zero);
begin = CGF.Builder.CreateInBoundsGEP(begin, gepIndices, "pad.arraybegin");
end = CGF.Builder.CreateInBoundsGEP(end, gepIndices, "pad.arrayend");
}
OpenPOWER on IntegriCloud