aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-05-23 20:00:44 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-05-23 20:00:44 +0000
commit92b9bd96ce25630f73717965fcaf4b5a761e49e5 (patch)
tree03e854ab61ce4e1a671e95c14e1b12d1451ee94c /lib/CodeGen/CGStmt.cpp
parenta481ec4150ad203440852a2bfee0883dd26f7530 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r--lib/CodeGen/CGStmt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 589273da43..3e807bdbc7 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -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();
}