From f0f0b7a0eb7607129c50fcbccd228c69f3451c79 Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 14 Sep 2015 18:57:08 +0000 Subject: 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 --- clang/lib/CodeGen/CGDecl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen') 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 gepIndices(arrayDepth, zero); + SmallVector gepIndices(arrayDepth+1, zero); begin = CGF.Builder.CreateInBoundsGEP(begin, gepIndices, "pad.arraybegin"); end = CGF.Builder.CreateInBoundsGEP(end, gepIndices, "pad.arrayend"); } -- cgit v1.2.3