From: Jim Paradis <jrp@jrp.tiac.net>
Subject: Re: SIGFPE
Date: Thu, 10 Apr 1997 12:09:56 -0400 [thread overview]
Message-ID: <67bb605c4cbb7eb387b41a2813a9ff68.axp-list@archive.invalid> (raw)
Olaf Flebbe wrote:
>
> Randy,
>
> [I did the first IEEE FPU exception things on linux/x86]
>
> Don't do a signal handler on SIGFPE, it will not work most of the time.
> On Intel processorcs the Floating point unit is decoupled from the
> Integer Unit. You will raise an floating point exception, (the kernel
> will send you a SIGFPE if you trigger souch a thing) if you access the
> floating point unit the next time *after* the exception occurs.
> Incidently gcc produces code which mixes up integer and floating point
> operations (for performance reasons) and therefore you will get an
> Exception at unpredictable times later in your code. [ In your code it
> will happen deep in the printf library code]. So don't to this, the
> argument may be correctly for other cpu/compiler combinations.
What you say is only partially correct. While it is true that Alpha
produces imprecise floating-point exceptions, if you code according to
certain rules then it is possible to backtrack from the reported
exception
PC to the actual faulting instruction. This is all documented in the
Alpha Architecture Reference Manual.
When you specify the "-mieee" flag to gcc, it generates recoverable
code. The recovery code itself is in the kernel
(arch/alpha/math-emu/fp-emul.c if you want to check it out). If
everything is working right, then the SIGFPE presented to the user
contains the CPU state at the point where the exception occurred.
> The IEEE754 states that no signal should be raised on invalid
> operations. They defined a set of pseudo numbers which define the
> outcome of an invalid operations like 1./0. [BTW this is INF].
> You are free to implement exception handlers and such things, but these
> should the default behaviour.
You're right. I checked the code and found to my horror that there's
a big hole in the divide-by-zero case. In ieee-math.c the divide
routines correctly return QNaN in the case of 0/0, but in the case of
nonzero/0 they fall through and cause a signal to be generated. I'll
come up with a fix for this soon...
> Linux/alpha should handle it correctly, not the JDK. I don't know the
> alpha, but on x86 it is an issue of correctly initialising the FPU.
--
Jim Paradis jrp@jrp.tiac.net
http://www.tiac.net/users/jrp/index.html
"It's not procrastination, it's my new Just-In-Time Workload Management
System!"
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next reply other threads:[~1997-04-10 16:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-04-10 16:09 Jim Paradis [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-08-27 14:23 SIGFPE Christopher J. Grayce
1997-04-10 18:31 SIGFPE Jim Paradis
1997-04-10 18:04 SIGFPE Randy Chapman
1997-04-10 19:07 ` SIGFPE Richard Henderson
1997-04-10 19:09 ` SIGFPE Richard Henderson
1997-04-10 11:41 SIGFPE Olaf Flebbe
1997-04-09 19:05 SIGFPE Jim Paradis
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox