Initialize the cleanup.dst variable if necessary. Fixes PR3789.

llvm-svn: 67075
This commit is contained in:
Anders Carlsson 2009-03-17 05:53:35 +00:00
parent e8911a9a13
commit e73e3ecc04
2 changed files with 23 additions and 3 deletions

View File

@ -561,9 +561,14 @@ CodeGenFunction::CleanupBlockInfo CodeGenFunction::PopCleanupBlock()
BranchFixups.size());
// Restore the current basic block (if any)
if (CurBB)
if (CurBB) {
Builder.SetInsertPoint(CurBB);
else
// If we had a current basic block, we also need to emit an instruction
// to initialize the cleanup destination.
Builder.CreateStore(llvm::Constant::getNullValue(llvm::Type::Int32Ty),
DestCodePtr);
} else
Builder.ClearInsertionPoint();
for (size_t i = 0, e = BranchFixups.size(); i != e; ++i) {

View File

@ -0,0 +1,15 @@
// RUN: clang -emit-llvm %s -o %t &&
// RUN: grep "store i32 0, i32* %cleanup" %t | count 2
void f(int n) {
int a[n];
{
int b[n];
if (n)
return;
}
if (n)
return;
}