[Bug libfortran/94586] trigd_lib.inc:84:28: error: implicit declaration of function 'fmaf'

sgk at troutmask dot apl.washington.edu gcc-bugzilla@gcc.gnu.org
Tue Apr 14 22:08:24 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94586

--- Comment #9 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Apr 14, 2020 at 08:48:47PM +0000, dave.anglin at bell dot net wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94586
> 
> --- Comment #8 from dave.anglin at bell dot net ---
> On 2020-04-14 2:12 p.m., sgk at troutmask dot apl.washington.edu wrote:
> > #ifdef HAVE_GFC_REAL_16
> > #endif
> This one.
> >
> > Is hppa64 claiming support for a REAL type that it actually
> > doesn't support?
> Support is a fuzzy word.  There's enough support to build libquadmath.

So, you have REAL(4), REAL(8), and REAL(16).  Is REAL(16) a
software implementaton of IEEE 128-bit floating point, which
uses libquadmath?  If yes, then this suggests the logic to
select the suffix 'q' or 'l' needs tweaking as you should be
getting, e.g., cosq() from libquadmath instead of cosl().

> > In any event, you can extend the kludge
> >
> > #if (__STDC_VERSION__ < 199901L)
> > #define fmaf(a,b,c) ((a)*(b)+(c))
> > #define fma(a,b,c) ((a)*(b)+(c))
> > #define fmal(a,b,c) ((a)*(b)+(c))
> > #define cosl(a) cos((double)(a))
> > #define sinl(a) sin((double)(a))
> > #define tanl(a) tan((double)(a))
> > #define fabsl(a) ((a) < 0 ? -(a) : (a))
> > #define copysignl(a,b) (fabsl(a)*((b)/fabsl(b)))
> > #endif
> I have something that builds now.  Need to test.
> 
> I think we need to use _POSIX_VERSION as __STDC_VERSION__ is set by cpp.

Looking at trigd.c, one finds

#ifdef GFC_REAL_16_IS_FLOAT128 /* libquadmath.  */
#define SUFFIX(x) x ## q
#else
#define SUFFIX(x) x ## l
#endif /* GFC_REAL_16_IS_FLOAT128  */

So, hppa64 has REAL(16), but it does not use __float128 or 
GFC_REAL_16_IS_FLOAT128 is somehow not getting set.  Instead 
of the above kludge you can do something like

#ifndef HAVE_COSL
#define cosl cosq  /* Use libquadmath for hppa64. */
#endif

HAVE_COSL, HAVE_SINL, HAVE_TANL are definitely available.
I don't recall if fabsl and copysignl have similar macros.


More information about the Gcc-bugs mailing list