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

Re: [PATCH, libgfortran]: Fix PR59313, gfortran.dg/erf_3.F90 FAILs


Uros Bizjak <ubizjak@gmail.com> writes:

> Currently, gfortran.dg/erf_3.F90 FAILs on targets with 128bit
> (quadruple) long double, since high-precision erfc_scaled_r16 gets
> defined only for __float128 quadruple precision.
>
> Attached patch defines this function also for 128bit long double targets.
>
> [BTW: The patch really implements what FX's ChangeLog says:
>
>     * intrinsics/erfc_scaled_inc.c: Do not provide quadruple
>     precision variant.]
>
> 2013-12-01  Uros Bizjak  <ubizjak@gmail.com>
>
>     PR libfortran/59313
>     * intrinsics/erfc_scaled.c (erfc_scaled_r16): Also provide for
>     quadruple precision long double variant.
>
> Tested on x86_64-pc-linux-gnu and alphaev68-pc-linux-gnu.
>
> OK for mainline?

Unfortunately, this breaks Solaris/SPARC bootstrap:

/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/erfc_scaled.c: In function 'erfc_scaled_r16':
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/erfc_scaled.c:64:22: error: 'M_2_SQRTPIl' undeclared (first use in this function)
 # define _M_2_SQRTPI M_2_SQRTPIl
                      ^
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/erfc_scaled.c:117:31: note: in expansion of macro '_M_2_SQRTPI'
       return (1 + sum) / x * (_M_2_SQRTPI / 2);
                               ^
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/erfc_scaled.c:64:22: note: each undeclared identifier is reported only once for each function it appears in
 # define _M_2_SQRTPI M_2_SQRTPIl
                      ^
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/erfc_scaled.c:117:31: note: in expansion of macro '_M_2_SQRTPI'
       return (1 + sum) / x * (_M_2_SQRTPI / 2);
                               ^
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/erfc_scaled.c:119:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[3]: *** [erfc_scaled.lo] Error 1

It seems M_2_SQRTPI[lq] are GNU extensions, thus missing in Solaris
<math.h>.  The following patch at least allows Solaris bootstrap to
continue:

diff --git a/libgfortran/intrinsics/erfc_scaled.c b/libgfortran/intrinsics/erfc_scaled.c
--- a/libgfortran/intrinsics/erfc_scaled.c
+++ b/libgfortran/intrinsics/erfc_scaled.c
@@ -61,6 +61,9 @@ see the files COPYING3 and COPYING.RUNTI
 #else
 
 # define _THRESH -106.566990228185312813205074546585730L
+# ifndef M_2_SQRTPIl
+#  define M_2_SQRTPIl 1.128379167095512573896158903121545172L
+# endif
 # define _M_2_SQRTPI M_2_SQRTPIl
 # define _INF __builtin_infl()
 # ifdef HAVE_ERFCL


I suppose the same should be done for M_2_SQRTPIq?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


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