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

fabs(-0.0) and soft-float


Hi guys.

I'm working on some soft-float patches for glibc which surfaced an
interesting problem.

Assume x = -0.0.  For x = fabs(x), gcc will fold this into:

	 if (x >= 0)
	    x = x;
	 else
	    x = -x;

The relationship "-0.0 >= 0.0" is true. So fabs(-0.0) will end up
returning -0.0 and not 0.0 like it should.

I've confirmed that compiling with -fno-builtin fixes my problem.

Should we have gcc fold fabs() like this:?

	 if (x > 0)
	   x = x;
	 else
	   x = -x;

Ideas?

Aldy


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