This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug tree-optimization/42286] October 23rd change to tree-ssa-pre.c breaks calculix on powerpc with -ffast-math



------- Comment #7 from segher at kernel dot crashing dot org  2010-01-05 15:57 -------
With -fno-signed-zeroes, a-b*c is transformed to -(b*c-a), which is a machine
instruction.  If the result would have been +0 before, it now is -0.
The code then takes the sqrt() of that; sqrt(-0) is -0.  This then is
passed to atan2(), which has a discontinuity at 0, and we get wildly
diverging results.

The compiler does nothing wrong here; the transformation is perfectly
valid.

A solution might be to transform e.g. atan2(x,y) into atan2(+0.+x,+0.+y)
when -fno-signed-zeroes is in effect (and of course somehow make sure
those additions aren't optimised away).  Similar for other math library
functions with discontinuities at +/- 0.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42286


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