This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: code optimizations and numerical research (Peter Jay Salzman) writes:

> Just to make sure --- so you're saying that even though I'm enabling SIGFPE
> to catch exceptions:


> all the talk about -ffast-math making the compiler assume that args and
> results of math operations are correct and finite has no bearing on either
> my code (which certainly doesn't do what you described above) or my enabling
> and catching FPE exceptions?

Obviously it's hard to be completely sure whether your code is going
to be OK.  But -ffast-math won't make SIGFPE signals go away.  It just
means, more or less, that the compiler will assume they won't happen.
If you don't try to resume execution of the failing operation after
receiving a SIGFPE error--if you just give an error or something--then
you should be fine.

In fact, enabling the SIGFPE signal as you do will probably make you
safer when using -ffast-math.  For example, -ffast-math may not handle
floating point infinities correctly, but you've asked for a signal
when an infinity is generated anyhow, so your code will presumably
never see one.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]