public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* When do I need -fnon-call-exceptions?
@ 2023-06-07 17:08 Helmut Zeisel
  2023-06-07 19:04 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Helmut Zeisel @ 2023-06-07 17:08 UTC (permalink / raw)
  To: gcc

I wrote some simple program that set a signal handler for SIGFPE, throws a C++ exception in the signal handler
and catches the exception.
I compiled with and without -fnon-call-exceptions (on x64 Linux).
In both cases, the result was the same: the exception was caught and the destructors were called as expected.
I also tried "-fno-non-call-exceptions -fexceptions" and got the same result.

My question: when do I really need -fnon-call-exceptions?
Is there some simple program where I can see the difference whether it is on or off??

Helmut


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

* Re: When do I need -fnon-call-exceptions?
  2023-06-07 17:08 When do I need -fnon-call-exceptions? Helmut Zeisel
@ 2023-06-07 19:04 ` Ian Lance Taylor
  2023-06-07 19:35   ` Eric Botcazou
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2023-06-07 19:04 UTC (permalink / raw)
  To: Helmut Zeisel; +Cc: gcc

On Wed, Jun 7, 2023 at 10:09 AM Helmut Zeisel via Gcc <gcc@gcc.gnu.org> wrote:
>
> I wrote some simple program that set a signal handler for SIGFPE, throws a C++ exception in the signal handler
> and catches the exception.
> I compiled with and without -fnon-call-exceptions (on x64 Linux).
> In both cases, the result was the same: the exception was caught and the destructors were called as expected.
> I also tried "-fno-non-call-exceptions -fexceptions" and got the same result.
>
> My question: when do I really need -fnon-call-exceptions?
> Is there some simple program where I can see the difference whether it is on or off??

On x864 Linux -fasynchronous-unwind-tables is the default.  That is
probably sufficient to make your test case work.

Ian

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

* Re: When do I need -fnon-call-exceptions?
  2023-06-07 19:04 ` Ian Lance Taylor
@ 2023-06-07 19:35   ` Eric Botcazou
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2023-06-07 19:35 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Helmut Zeisel, gcc, gcc

> On x864 Linux -fasynchronous-unwind-tables is the default.  That is
> probably sufficient to make your test case work.

The testcase g++.dg/torture/except-1.C you recently added to the testsuite 
does not pass at all if -fnon-call-exceptions is not specified (and does not 
pass with optimization if -fno-delete-dead-exceptions is not specified).

-- 
Eric Botcazou



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

end of thread, other threads:[~2023-06-07 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 17:08 When do I need -fnon-call-exceptions? Helmut Zeisel
2023-06-07 19:04 ` Ian Lance Taylor
2023-06-07 19:35   ` Eric Botcazou

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).