[Bug middle-end/82504] Optimize away exception allocation and throws handled by catch(...){}
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Oct 10 14:29:00 GMT 2017
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;
}
More information about the Gcc-bugs
mailing list