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 #9 from rguenther at suse dot de  2010-01-05 16:03 -------
Subject: Re:  October 23rd change to tree-ssa-pre.c
 breaks calculix on powerpc with -ffast-math

On Tue, 5 Jan 2010, segher at kernel dot crashing dot org wrote:

> ------- 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.

Right.  Just it might be simpler with -fno-signed-zeros to
transform a-b*c to 0 + -(b*c-a).  Of course if the result was -0
before then it will be +0 after either variant (and the atan2 
discontinuity would still happen even with your fix).

Thus whatever "fix" the underlying problem is surely that calculix
is not really -fno-signed-zeros safe.  Can't we get lucky again
as before by trying to recover the PRE code change?

Richard.


-- 


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]