> First, I do think that FPE is not due to GCC, since compiled programs with
> DEC FORTAN90 have
> nothing to do with GCC, but yet FPE occurs.
> Yesterday I compiled kernel 2.2.12. It runs OK, and there are no more <sc *>
> messages.
> However, I still don't know how to get rid of FPEs. Do You have any recipes
> how
> to get rid of that???
hmm, seems when two weeks ago after I had just installed this nice
SX164, my news system was misconfiged and thus my call for help in the
very same subject didn't get thru... I've since learned the following
and I'd appreciate to get even more (or better) information on it.
Here we go:
1) the Alpha is not fully IEEE compliant by itself and differs from
other processors in that the FPU exception cannot be switched off.
When a division by zero appears then other processors represent
the result with a special bit pattern which has the meaning "this
result is invalid" while the alpha fires an exception (same for
underflows, overflows and undefined operations, of course)
2) the alpha is faster in floating point. Part of this is because it
doesn't have to treat those special bit patterns (NaN, INF and
friends, which are defined somewhere in math.h on i86 Linux).
3) someone suggested using the -mieee switch to gcc to get the same
behaviour as with the defaults on i86. I have not tried it though.
4) Exception handling is easy:
a) make a global variable to hold error codes
volatile int my_err;
b) write the error handler, which might be as lean as
static void my_fpu_handler(int err)
{
my_err = err; /* my_err defined globally and volatile */
}
c) install the handler:
void (*oldhandler)(); /* keep a reference to the initial value
so it can be restored later */
oldhandler = signal(SIGFPE, my_fpu_handler);
if (SIG_ERR == oldhandler) {
/* you might want to write your own BARF(), of course */
BARF("cannot install floating point exception handler");
}
d) instead of using the functions isnan(), finite() and friends to
check results for validity, check the content of my_err and reset
it to zero after having taken sensible measures.
5) Code which neither uses exception handling nor the ieee-conformant
finite() isnan() ... functions to test results is broken by
design.
6) the gcc-documentation is rather good, it's just a bit hard to read
because it's in info format. Same for the glibc-documentation;
-mieee and friends are described in the egcs node about
architecture-dependent options, the signal() function is in the
glibc docs. Both are definitely worth reading if you want to make
use of the alpha's superior floating point performance.
kind regards,
--
Eberhard Burr check http://www.uni-karlsruhe.de/~Eberhard.Burr/publickey.asc
for PGP Key -- #include <stddisc.h> -- electric cookie follows
Truly simple systems... require infinite testing.
-- Norman Augustine