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

Baber Nawaz <baber.nawaz at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baber.nawaz at hotmail dot com

--- Comment #18 from Baber Nawaz <baber.nawaz at hotmail dot com> ---
Here is a testcase with ordinary C++ exceptions, with no traps, signals
or -fnon-call-exceptions:

int x;

[[gnu::noipa]] void f () {}
void t () { throw 0; }

struct S
{
  ~S () { if (--x == 0) { x = 1; f (); } }
};

[[gnu::noipa]] void g () { S s; t (); }

int
main ()
{
  x = 2;
  try { g (); } catch (...) {}
  if (x != 1)
    __builtin_abort ();
}

$ g++ -O1 pr85803-eh.C && ./a.out
Aborted

It aborts at -O1, -O2 and -O3 with 12.5, 13.4, 14.3, 15.2, 16.2 and trunk
(17.0.0 20261110) on x86_64-linux-gnu (Compiler Explorer builds), and
passes at -O0 and with -O1 -fno-tree-dse.

Reply via email to