From patchwork Sat Dec 1 01:37:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [libgcc] Bug in fp-bit.c when NO_NANS is defined From: Steve Ellcey X-Patchwork-Id: 203094 Message-Id: <3fb4ebdd-4f24-4946-bfde-b0a1ae251bf9@EXCHHUB01.MIPS.com> To: Date: Fri, 30 Nov 2012 17:37:13 -0800 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 * 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; }