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: [gfortran,ping] support for large kinds in front-end and library


On Mon, Sep 12, 2005 at 08:35:44AM -0700, Steve Kargl wrote:
> On Mon, Sep 12, 2005 at 04:18:15PM +0100, Paul Brook wrote:
> > 
> > My guess is your m4 doesn't understand -D, or something like that.
> > 
> 
> A transcript of the build shows
> 
> m4 -Dfile=generated/_sin_c4.F90 -I../../../gcc41/libgfortran/m4 specific.m4 > ..
> /../../gcc41/libgfortran/generated/_sin_c4.F90
> 
> The FreeBSD man page says that both -D and -I are supported.
> It further states "The m4 utility follows the Version 2 of the Single
> UNIX Specification (SUSv2), along with a few extensions taken from
> GNU-m4.  Flags -I, -d, and -t are non-standard."  Does GNU-m4 have
> extensions to the m4 language and does libgfortran use those extensions?
> 
> I have gm4 installed.  I'll see if I can make gcc use it.
> 

I forced the use of gm4 and it indeed fixes the problem.
Thanks Paul.

Now, we fail ithe testsuite with
/home/kargl/gcc/obj41/i386-unknown-freebsd7.0/./libgfortran/.libs/\
libgfortran.so: undefined reference to `asinl'
: undefined reference to `atan2l'
: undefined reference to `sqrtl'
: undefined reference to `tanhl'
: undefined reference to `sinl'
: undefined reference to `atanl'
: undefined reference to `logl'
: undefined reference to `tanl'
: undefined reference to `coshl'
: undefined reference to `acosl'
: undefined reference to `hypotl'
: undefined reference to `cosl'
: undefined reference to `expl'
: undefined reference to `sinhl'

These, of course, are the C99 long double math functions.  I suspect
many (most?) non-glibc based systems will not have these functions
in libm.  I know FreeBSD, NetBSD, and OpenBSD do not have these.

So, we need to have configure check if these exists in libm,
and if not, we need to provide implementations.  We could do
this by 

  1) Importing code from glibc.  We'll need to review the 
     code for Copyright violations and quality of implementation
     issues.

  2) Implement these functions via MPFR.  For example

     long double logl(long double x) {

       /* log(+Inf) = +Inf */
       if (isinf(x)) return x*x+x;

       /* log(NaN) =  NaN with signal */
       if (isnan(x)) return (x+x);

       /* log(x) = sNaN if x < 0. */
       if (x < zero) return (x - x) / (x - x);

       /* log(+-0) = -Inf with signal */
       if (x == zero) return (- 1.0L / zero);

       Convert x to mpfr_t value (need to set mpfr precision)
       evaluate mpfr_log
       convert mpfr_t value to C99 long double
       return C99 value

     }

-- 
Steve


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