[patch, libgcc] Bug in fp-bit.c when NO_NANS is defined

Steve Ellcey sellcey@mips.com
Sat Dec 1 01:37:00 GMT 2012


While investigating some soft-float issues I tried compiling fp-bit.c in
libgcc with NO_NANS defined.  I wound up with an undefined reference to
makenan.

Here is my attempt at a patch to fix the problem but I am not sure if
returning 0 is the right thing to do for b/0 when NO_NANS is defined.

isinf is always going to be false when NO_NANS is defined so it
is only a question of what to do for iszero(a) that we need to worry
about. b at this point may or may not be zero.

OK to checkin or should I return something else?

Steve Ellcey
sellcey@mips.com


2012-11-30  Steve Ellcey  <sellcey@mips.com>

	* fp-bit.c (_fpdiv_parts): Do not call makenan if NO_NANS defined.


diff --git a/libgcc/fp-bit.c b/libgcc/fp-bit.c
index 7509f76..10a6b3a 100644
--- a/libgcc/fp-bit.c
+++ b/libgcc/fp-bit.c
@@ -979,8 +979,10 @@ _fpdiv_parts (fp_number_type * a,
 
   if (isinf (a) || iszero (a))
     {
+#ifndef NO_NANS
       if (a->class == b->class)
 	return makenan ();
+#endif
       return a;
     }
 



More information about the Gcc-patches mailing list