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

login
register
mail settings
Submitter Steve Ellcey
Date Dec. 1, 2012, 1:37 a.m.
Message ID <3fb4ebdd-4f24-4946-bfde-b0a1ae251bf9@EXCHHUB01.MIPS.com>
Download mbox | patch
Permalink /patch/203094/
State New
Headers show

Comments

Steve Ellcey - Dec. 1, 2012, 1:37 a.m.
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.
Joseph S. Myers - Dec. 1, 2012, 2:25 a.m.
On Fri, 30 Nov 2012, Steve Ellcey  wrote:

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

Unless anything in the tree defines NO_NANS, I suggest we remove all 
support for such a macro from fp-bit.  As I noted in 
<http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00819.html>, I believe all 
the support in fp-bit for the IRIX variant of IBM long double can also be 
removed, and the associated code in real.[ch].

Patch

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;
     }