[cfe-commits] r104472 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGenCXX/PR5863-unreachable-block.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sun May 23 13:00:45 PDT 2010
Author: d0k
Date: Sun May 23 15:00:44 2010
New Revision: 104472
URL: http://llvm.org/viewvc/llvm-project?rev=104472&view=rev
Log:
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.
Added:
cfe/trunk/test/CodeGenCXX/PR5863-unreachable-block.cpp
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=104472&r1=104471&r2=104472&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun May 23 15:00:44 2010
@@ -80,7 +80,7 @@
// 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();
}
Added: cfe/trunk/test/CodeGenCXX/PR5863-unreachable-block.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR5863-unreachable-block.cpp?rev=104472&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/PR5863-unreachable-block.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/PR5863-unreachable-block.cpp Sun May 23 15:00:44 2010
@@ -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
+}
More information about the cfe-commits
mailing list