On powerpc64le, kinds-override.h unconditionally defines a second
128-bit real kind (REAL(KIND=17), _Float128) whenever long double is
16 bytes, assuming long double is IBM double-double so a distinct
IEEE-128 kind is needed.  When long double already is IEEE-128
(__LONG_DOUBLE_IEEE128__) KIND=17 duplicates KIND=16, and unless
USE_IEC_60559 is defined the *_r17.c files use the libquadmath *q
entry points (jnq, fabsq, ...).  When libquadmath is not configured
(HAVE_FLOAT128 undefined) those are undeclared, so libgfortran fails
to build with "implicit declaration of function 'jnq'" -- an error
since GCC 14.  Reproducible on FreeBSD 16 powerpc64le, which defaults
long double to IEEE-128.

Only define the separate _Float128 KIND=17 when long double is not
already IEEE-128.

libgfortran/ChangeLog:

        * kinds-override.h: Do not define REAL(KIND=17) when long double
        is already IEEE 128-bit (__LONG_DOUBLE_IEEE128__).

Signed-off-by: Piotr Kubaj <[email protected]>
---
 libgfortran/kinds-override.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgfortran/kinds-override.h b/libgfortran/kinds-override.h
--- a/libgfortran/kinds-override.h
+++ b/libgfortran/kinds-override.h
@@ -30,7 +30,7 @@
 #endif
 
 /* Keep these conditions on one line so grep can filter it out.  */
-#if defined(__powerpc64__)  && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__  && 
__SIZEOF_LONG_DOUBLE__ == 16
+#if defined(__powerpc64__)  && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__  && 
__SIZEOF_LONG_DOUBLE__ == 16 && !defined(__LONG_DOUBLE_IEEE128__)
 typedef _Float128 GFC_REAL_17;
 typedef _Complex _Float128 GFC_COMPLEX_17;
 #define HAVE_GFC_REAL_17

-- 
2.49.0

Reply via email to