This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/82504] Optimize away exception allocation and throws handled by catch(...){}
- From: "antoshkka at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Oct 2017 14:29:29 +0000
- Subject: [Bug middle-end/82504] Optimize away exception allocation and throws handled by catch(...){}
- Auto-submitted: auto-generated
- References: <bug-82504-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82504
--- Comment #2 from Antony Polukhin <antoshkka at gmail dot com> ---
+1. Some realistic code examples were the optimization could be very useful if
triggered after inlining:
// Destructors
bar::~bar() {
try {
cleanup_some_dangerous_resources();
} catch(...) {}
}
// Logging
#define SafeLog(X) try { g_logger << X << std::endl; } catch (...){}
// Poor Try* functions
bool try_parse(const char* text) {
try {
parse_text(text); // throws
} catch (...) {
return false;
}
return true;
}