http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53294
Bug #: 53294 Summary: Optimize out some exception code Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: gli...@gcc.gnu.org Hello, it would be great if the compiler could transform code like: try { throw 42; } catch(...) { } into nothing (or in practice into a simple goto, since there will be code around). It already knows to remove the code after "throw", it could statically check that the exception will be caught locally and thus skip the __cxa_throw, __cxa_begin_catch game. Filed as C++ front-end, but it might be for the middle-end, since it would be best if this optimization happened after inlining.