[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SIGFPE resolution?



> > > There was one suggestion to disable -mieee by -ffast-math. -ffast-math
> > > also enables a *lot* of other optimizations, so if you don't want IEEE
> > > compliance, you might want it anyway. Would that be acceptable to you?
> >
> > I'm okay with this sugesstion, as long as Debian on Alpha enables
> > fast math by exception and not as the rule.
>
> That was the idea.

I did some quick reading on -ffast-math and if someone wants to do this, then 
I think the switch they are looking for is not -ffast-math, but rather 
-ffinite-math-only.  The documentations says this option allows optimizations 
for floating point arithmetic which assumes arguments and results are not 
NaNs or +-Infs.

It also happens to be one of the -f options that -ffast-math turns on, so it 
would have the same end effect.

For anyone who wants to submit a patch to this end, and has the time, I 
believe a good place to start figuring out the how to might be the 
OVERRIDE_OPTIONS macro hook (see Run-time Target Specification under Target 
Description Macros and Functions in the GCC internals documentation).

Maybe you could grep the source code under some of the other architectures (I 
seems to recall no luck in grepping the Alpha specific code) and find an 
example of it's use 

> > My concern is also dependencies - people will insist on building
> > glibc, etc with fast math enabled (because by default they'll work
> > fine) and then some other application with throw down IEEE values to
> > them an they'll crash.
>
> AFAIK, libm from glibc is currently built IEEE compliant, and I don't
> think that should change unless we introduce some mechanism to choose
> a libm based on compiler flags (which would be nice, though).

Yup.  It is too bad that the -ffinite-math-only switch (and hence -ffast-math) 
doesn't actually seem to break NaNs and +-Infs on the x86's...

In any event, in response to the question originating this conversation.

I did submit a patch to make -mieee the default.  It was accepted into gcc-3.3 
1:3.3.2ds3-0pre5 at the Debian level.  The debian/rules.patch file, however, 
was accidentally not updated to apply the patch during the build process.

I've just recently submitted a request to have this fixed.

Later  -T

Before anyone screams too loudly, please remember that you can still compile 
your favorite piece of code without IEEE compliance.  Just add the -mno-ieee 
compiler option to your CFLAGS (CXXFLAGS) variable.

For the really hardcore, I think you can even make it a standard default on 
your box by editing your /usr/lib/gcc-3.x.x/specs file... *grin*

(for the curious, the patch doesn't work this way, as I couldn't figure out 
how to do it in an architecture clean way at the GCC source level)

-- 
 Tyson Whitehead  (-twhitehe@uwo.ca -- WSC-)
 Computer Engineer                        Dept. of Applied Mathematics,
 Graduate Student- Applied Mathematics    University of Western Ontario,
 GnuPG Key ID# 0x8A2AB5D8                 London, Ontario, Canada



Reply to: