[LLVMbugs] [Bug 17872] New: Inliner can drop "cleanup" clause when inlining; C++ destructors not run
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Nov 10 15:41:46 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=17872
Bug ID: 17872
Summary: Inliner can drop "cleanup" clause when inlining; C++
destructors not run
Product: tools
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: opt
Assignee: unassignedbugs at nondot.org
Reporter: mseaborn at chromium.org
CC: isanbard at gmail.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
InlineFunction.cpp doesn't look at the "cleanup" flag on landingpad
instructions. If it inlines an inner "invoke" instruction without "cleanup"
into an "invoke" call site with "cleanup", the latter's "cleanup" flag is lost.
This can lead to C++ destructors not being called when an exception is thrown.
Here's an example. This prints "in cleanup" at -O0 but not at -O2:
#include <stdio.h>
class MyClass {
public:
~MyClass() { printf("in cleanup\n"); }
};
class DummyException1 {};
class DummyException2 {};
void throw_func() {
throw 1;
}
static void inner() {
try {
throw_func();
} catch (DummyException1 &) {}
}
void outer() {
MyClass x;
try {
inner();
} catch (DummyException2 &) {}
}
int main() {
try {
outer();
} catch (int) {}
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131110/0d7265f9/attachment.html>
More information about the llvm-bugs
mailing list