forked from OSchip/llvm-project
PR5863: Don't erase unreachable BBs which have an associated cleanup size.
This works around a crash where malloc reused the memory of an erased BB for a new BB leaving old cleanup information pointing at the new block. llvm-svn: 104472
This commit is contained in:
parent
a09387df9f
commit
11d4d9ec4e
|
@ -80,7 +80,7 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
|
|||
// explicitly here. This handles the common case of a call to a noreturn
|
||||
// function.
|
||||
if (llvm::BasicBlock *CurBB = Builder.GetInsertBlock()) {
|
||||
if (CurBB->empty() && CurBB->use_empty()) {
|
||||
if (CurBB->empty() && CurBB->use_empty() && !BlockScopes.count(CurBB)) {
|
||||
CurBB->eraseFromParent();
|
||||
Builder.ClearInsertionPoint();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -emit-llvm-only %s
|
||||
|
||||
// PR5836
|
||||
class E { };
|
||||
|
||||
void P1() {
|
||||
try {
|
||||
int a=0, b=0;
|
||||
if (a > b) // simply filling in 0 or 1 doesn't trigger the assertion
|
||||
throw E(); // commenting out 'if' or 'throw' 'fixes' the assertion failure
|
||||
try { } catch (...) { } // empty try/catch block needed for failure
|
||||
} catch (...) { } // this try/catch block needed for failure
|
||||
}
|
Loading…
Reference in New Issue