[Bug fortran/79305] real128 - undefined reference to cexpl
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 31 18:00:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79305
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to Anton Shterenlikht from comment #0)
> FreeBSD 11.0-RELEASE-p2
>
> use, intrinsic :: iso_fortran_env, only: real128
> integer, parameter :: fk = real128
> complex( kind=fk ) :: z
> z = cmplx( 1.0_fk, -1.0_fk, kind=fk )
> write (*,*) exp( z )
> end
>
> $ gfortran49 z.f90
> /tmp//ccIF7kVE.o: In function `MAIN__':
> z.f90:(.text+0x79): undefined reference to `cexpl'
> collect2: error: ld returned 1 exit status
>
> Have I missed something?
>
Yes, probably a few things. What are you trying to
accomplish with using REAL128? This maps to REAL(10)
instead of REAL(16). The end resutl is that z will
have a 64-bit significand whereas the name REAL128
suggests that it should have a 113-bit significand.
In additional, FreeBSD's libm does not have a cexpl
function. You'll need to submit a bug report with
FreeBSD; although it won't help much as no one is
actively working on FreeBSD's libm shortcomings.
config.h in obj7/x86_64-unknown-freebsd12.0/libgfortran
shows the expected
/* Define to 1 if you have the `cexpl' function. */
/* #undef HAVE_CEXPL */
This then gets you to gcc7/libgfortran/c99_protos.h
#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) &&
defined(EXPL)
#define HAVE_CEXPL 1
extern long double complex cexpl (long double complex);
#endif
so cexpl is exposed to libgfortran; howerver, one then find
in intrinsics/c99_functions.c
#if !defined(HAVE_CEXPL) && defined(HAVE_COSL) && defined(HAVE_SINL) &&
defined(EXPL)
#define HAVE_CEXPL 1
long double complex cexpl (long double complex z);
long double complex
cexpl (long double complex z)
{
long double a, b;
long double complex v;
a = REALPART (z);
b = IMAGPART (z);
COMPLEX_ASSIGN (v, cosl (b), sinl (b));
return expl (a) * v;
}
#endif
The above will clearly never be built. In fact, a causal perusal
of c99_protos.h shows that none of the fallback functions in
c99_functions.c are built.
More information about the Gcc-bugs
mailing list