public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called
@ 2023-07-28  4:53 ed at catmur dot uk
  2023-07-28  4:55 ` [Bug c++/110835] " ed at catmur dot uk
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ed at catmur dot uk @ 2023-07-28  4:53 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/110835] -fsanitize=address causes slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
@ 2023-07-28  4:55 ` ed at catmur dot uk
  2023-07-28  5:06 ` [Bug sanitizer/110835] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ed at catmur dot uk @ 2023-07-28  4:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

--- Comment #1 from Ed Catmur <ed at catmur dot uk> ---
Motivation is
https://github.com/boostorg/exception/blob/b039b4ea18ef752d0c1684b3f715ce493b778060/include/boost/exception/detail/exception_ptr.hpp#L550
; the half-reduced code is:

#include <boost/exception_ptr.hpp>
struct S {};
int main() {
    auto ep = boost::copy_exception(S());
    for (int i = 0; i != 100000; ++i)
        try { boost::rethrow_exception(ep); } catch (...) {}
}

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] -fsanitize=address causes slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
  2023-07-28  4:55 ` [Bug c++/110835] " ed at catmur dot uk
@ 2023-07-28  5:06 ` pinskia at gcc dot gnu.org
  2023-07-28  5:10 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28  5:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu.org,
                   |                            |dvyukov at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |kcc at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
          Component|c++                         |sanitizer

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code generation does not look any difference ...
So I am suspecting this was a library change.
Which might mean it is an issue in LLVM too ...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] -fsanitize=address causes slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
  2023-07-28  4:55 ` [Bug c++/110835] " ed at catmur dot uk
  2023-07-28  5:06 ` [Bug sanitizer/110835] " pinskia at gcc dot gnu.org
@ 2023-07-28  5:10 ` pinskia at gcc dot gnu.org
  2023-07-28  5:10 ` [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28  5:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Which might mean it is an issue in LLVM too ...

Yes the same runtime regression shows up between clang 15 and clang 16. This
should reported upstream to them too.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
                   ` (2 preceding siblings ...)
  2023-07-28  5:10 ` pinskia at gcc dot gnu.org
@ 2023-07-28  5:10 ` pinskia at gcc dot gnu.org
  2023-07-28  5:12 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28  5:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-fsanitize=address causes   |[13/14 Regression]
                   |slowdown from               |-fsanitize=address causes
                   |std::rethrow_exception not  |huge runtime slowdown from
                   |called                      |std::rethrow_exception not
                   |                            |called
   Target Milestone|---                         |13.3
   Last reconfirmed|                            |2023-07-28
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
                   ` (3 preceding siblings ...)
  2023-07-28  5:10 ` [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime " pinskia at gcc dot gnu.org
@ 2023-07-28  5:12 ` pinskia at gcc dot gnu.org
  2023-07-28  8:01 ` ed at catmur dot uk
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28  5:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > Which might mean it is an issue in LLVM too ...
> 
> Yes the same runtime regression shows up between clang 15 and clang 16. This
> should reported upstream to them too.

What is interesting is that with -stdlib=libc++ the regression for clang/LLVM
shows up between their 14 and 15 releases.

Anyways this should be filed upstream ...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
                   ` (4 preceding siblings ...)
  2023-07-28  5:12 ` pinskia at gcc dot gnu.org
@ 2023-07-28  8:01 ` ed at catmur dot uk
  2023-12-12 23:12 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ed at catmur dot uk @ 2023-07-28  8:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

--- Comment #6 from Ed Catmur <ed at catmur dot uk> ---
Thanks, filed https://github.com/llvm/llvm-project/issues/64190 .

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
                   ` (5 preceding siblings ...)
  2023-07-28  8:01 ` ed at catmur dot uk
@ 2023-12-12 23:12 ` pinskia at gcc dot gnu.org
  2024-03-07 23:27 ` law at gcc dot gnu.org
  2024-05-21  9:16 ` [Bug sanitizer/110835] [13/14/15 " jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-12 23:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tnfchris at gcc dot gnu.org

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 112981 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
                   ` (6 preceding siblings ...)
  2023-12-12 23:12 ` pinskia at gcc dot gnu.org
@ 2024-03-07 23:27 ` law at gcc dot gnu.org
  2024-05-21  9:16 ` [Bug sanitizer/110835] [13/14/15 " jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 23:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/110835] [13/14/15 Regression] -fsanitize=address causes huge runtime slowdown from std::rethrow_exception not called
  2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
                   ` (7 preceding siblings ...)
  2024-03-07 23:27 ` law at gcc dot gnu.org
@ 2024-05-21  9:16 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-05-21  9:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110835

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.3                        |13.4

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 13.3 is being released, retargeting bugs to GCC 13.4.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-05-21  9:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28  4:53 [Bug c++/110835] New: -fsanitize=address causes slowdown from std::rethrow_exception not called ed at catmur dot uk
2023-07-28  4:55 ` [Bug c++/110835] " ed at catmur dot uk
2023-07-28  5:06 ` [Bug sanitizer/110835] " pinskia at gcc dot gnu.org
2023-07-28  5:10 ` pinskia at gcc dot gnu.org
2023-07-28  5:10 ` [Bug sanitizer/110835] [13/14 Regression] -fsanitize=address causes huge runtime " pinskia at gcc dot gnu.org
2023-07-28  5:12 ` pinskia at gcc dot gnu.org
2023-07-28  8:01 ` ed at catmur dot uk
2023-12-12 23:12 ` pinskia at gcc dot gnu.org
2024-03-07 23:27 ` law at gcc dot gnu.org
2024-05-21  9:16 ` [Bug sanitizer/110835] [13/14/15 " jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).