From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6EC973858D37; Fri, 28 Jul 2023 04:53:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EC973858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690519996; bh=V/cnsC3dEurt6Cq/20dQACVLIYxI3vw+0O9XZDKdY1k=; h=From:To:Subject:Date:From; b=fydAokgLAuDICTuhCw9xCpuJWSHUOmLZpySANLyd/TS6Q6iaCrHqStiI8JpSzejUE WJZGk7nElvl1YI6UWIrFurRPcCIbMcLmuxSpYeoVMnWXeAaViUcYN47lNvCQvRMfov riE3yR1lwKhEsLKN1N6S2FAb+nuZ5bHFUtda9z1k= From: "ed at catmur dot uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called Date: Fri, 28 Jul 2023 04:53:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ed at catmur dot uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110835 Bug ID: 110835 Summary: -fsanitize=3Daddress 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 std::exception_ptr p; void f() { try { throw 1; } catch(char) { std::rethrow_exception(p); } } int main() { for (int i =3D 0; i !=3D 100000; ++i) try { f(); } catch (...) { } } Compiled with -fsanitize=3Daddress (and at -O0 through -O3), this is roughl= y 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 essentia= l to exhibit the bug. Also `f` needs to be a separate function (and not `static`= ). At low optimization levels it can be an iife.=