[parisc-linux] floating point exception error

David Huggins-Daines dhd@linuxcare.com
27 Sep 2000 16:41:38 -0400


Matt Taggart <taggart@carmen.fc.hp.com> writes:

> In trying to build mawk I ran into a bug when the configure tried to test 
> "floating point exceptions". Attached is the output. BTW- the gawk does 
> something similar at the same point in it's configure.

Some additional info, since I'm aware of this bug:

The problem here is that the SIGFPE is not being delivered when the
test program expects it to be (the test program here being fpe_check.c
in the mawk sources).

First the program tries to generate divide-by-zero and overflow
exceptions.  I don't think the former ends up generating an exception,
but the latter does.  However this exception does not occur
immediately due to the odd 'deferred trapping' that the PA-RISC FPU
does.  The program then goes on to do some other stuff (testing
representation of NaN), which it does not expect to trap.  The next
floating point instruction occurs in maybe_nan(), and causes the
delayed trap to occur.

Since its SIGFPE handler does 'longjmp' to a place after where each
exception was expected to occur, this means the process jumps
backwards to the overflow test, and then loops endlessly doing this.

I don't understand the mechanics of FPU exceptions on PA-RISC at all.
The delayed trapping scheme and multiple exception registers are weird
to say the least - all machines I've seen in the past are either
totally imprecise like older Alphas, or deliver one exception at a
time, synchronously, the way that user code expects them to.

We probably need more complicated FPU trap logic in the kernel in
order to deliver exceptions in the proper POSIX and IEEE manner.  I
would appreciate it if someone from HP could comment on this - how
does HP/UX handle this?

-- 
dhd@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.