Patchwork [libquadmath,committed] fix signbit call (was: Re: Test failures when compiling gfortran/libquadmath with -O0)

login
register
mail settings
Submitter Tobias Burnus
Date Feb. 17, 2013, 1:18 p.m.
Message ID <5120D88A.9060905@net-b.de>
Download mbox | patch
Permalink /patch/221059/
State New
Headers show

Comments

Tobias Burnus - Feb. 17, 2013, 1:18 p.m.
Tilo Schwarz wrote:
> I built gfortran with -O0 in order to follow some gfortran code paths 
> in gdb.
> Now I noticed, that many of the tests in the fortran testsuite fail, 
> because of
> .../gcc/build/i686-pc-linux-gnu/./libquadmath/.libs/libquadmath.so: 
> undefined reference to `signbit'
>
> I was wondering
> - if that is on purpose
> - if I am doing something wrong
> - if there is an easy workaround (trying to link with -lm did not help).

I think it is a bug of mine (from 2012-11-01) when converting from 
GLIBC. signbit is a macro which gets translated into 
__signbitf/__signbit/__signbitl; thus, "signbit" is not in any library. 
Still, I don't understand why it only fails without optimization – I had 
expected that it either gets translated into __signbitl – thus, 
"signbit" shouldn't appear in the error message. Or that is remains as 
is – but that should fail also with optimization.

I have now committed the attached patch (as Rev. 196109).

Tobias

PS: At some point (in 4.9), the following commits should be ported from 
GLIBC to libquadmath:
Fix casinh spurious underflows away from [-i,i] (bug 15062).
Fix cacos real-part inaccuracy for result real part near 0 (bug 15023).
Fix casinh, casin overflow (bug 14996).
Fix casinh, casin inaccuracy from cancellation (bug 14994).
Fix powl inaccuracy for x86_64 and x86 (bug 13881).
and finally get some test-suite running, based on the GLIBC version.

Patch

Index: libquadmath/ChangeLog
===================================================================
--- libquadmath/ChangeLog	(Revision 196108)
+++ libquadmath/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@ 
+2013-02-17  Tobias Burnus  <burnus@net-b.de>
+
+	* math/cacoshq.c (cacoshq): Call signbitq instead of signbit.
+
 2013-02-06  Richard Sandiford  <rdsandiford@googlemail.com>
 
 	Revert previous patch.
Index: libquadmath/math/cacoshq.c
===================================================================
--- libquadmath/math/cacoshq.c	(Revision 196108)
+++ libquadmath/math/cacoshq.c	(Arbeitskopie)
@@ -70,7 +70,7 @@ 
 	 some cases.  */
       res = 2.0Q * clogq (csqrtq ((x + 1.0Q) / 2.0Q)
 			    + csqrtq ((x - 1.0Q) / 2.0Q));
-      if (signbit (__real__ res))
+      if (signbitq (__real__ res))
 	__real__ res = 0.0Q;
     }
   else