https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835
Bug ID: 110835 Summary: -fsanitize=address causes slowdown from std::rethrow_exception not called Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- #include <exception> std::exception_ptr p; void f() { try { throw 1; } catch(char) { std::rethrow_exception(p); } } int main() { for (int i = 0; i != 100000; ++i) try { f(); } catch (...) { } } Compiled with -fsanitize=address (and at -O0 through -O3), this is roughly 30x slower under gcc 13 than under gcc 12 (4.7s vs 0.15s on my Core i7 3 GHz). Note that the std::rethrow_exception() is not called, but is still essential to exhibit the bug. Also `f` needs to be a separate function (and not `static`). At low optimization levels it can be an iife.