gnu.gcc.help
[Top] [All Lists]

Re: Catching SIGFPE two times

Subject: Re: Catching SIGFPE two times
From: Bernd Strieder <strieder@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Jul 2008 11:06:12 +0200
Newsgroups: gnu.gcc.help

Hello,

thomas.mertes@xxxxxx wrote:

> I have problems when I try to catch a division by zero for
> two times. I try to emulate exceptions with setjmp/longjmp.
> 
> To catch a division by zero I use a handler for the signal
> SIGFPE. In the signal handler I use longjmp to jump to the
> exception handler.

> Has someone an idea how a program can have more than
> one SIGFPE catched with a setjmp/longjmp exception?

See the discussion at:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1305.pdf

and the following sections of the glibc info pages.

20.7 Floating-Point Control Functions
24.2.1 Program Error Signals

Returning from the SIGFPE handler the first time already invokes
undefined behaviour. The second time is completely off.

Bernd Strieder


<Prev in Thread] Current Thread [Next in Thread>