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

--- Comment #23 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #22)
> I think for libgfortran the cleanest would be in the configure check whether
> long double is IEEE quad and if so, have libgfor_cv_have_float128 no.
> That can be e.g.
> #if __LDBL_MANT_DIG__ == __FLT128_MANT_DIG__ && __LDBL_MIN_EXP__ ==
> __FLT128_MIN_EXP__
> #error long double is IEEE quad, no need for _Float128/__float128
> #endif

Something like

diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index a73207e5465..bf42d4df012 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -274,6 +274,10 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
   AC_CACHE_CHECK([whether we have a usable _Float128 type],
                  libgfor_cv_have_float128, [
    GCC_TRY_COMPILE_OR_LINK([
+    #if __LDBL_MANT_DIG__ == __FLT128_MANT_DIG__ && __LDBL_MIN_EXP__ ==
__FLT128_MIN_EXP__
+    #error long double is IEEE quad, no need for _Float128/__float128
+    #endif
+
     _Float128 foo (_Float128 x)
     {
      _Complex _Float128 z1, z2;
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index 349be2607c6..585bf2c71b5 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -233,6 +233,10 @@ AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test
"x$quadmath_use_symver" = xsun])

 AC_CACHE_CHECK([whether __float128 is supported], [libquad_cv_have_float128],
   [GCC_TRY_COMPILE_OR_LINK([
+    #if __LDBL_MANT_DIG__ == __FLT128_MANT_DIG__ && __LDBL_MIN_EXP__ ==
__FLT128_MIN_EXP__
+    #error long double is IEEE quad, no need for _Float128/__float128
+    #endif
+
     #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
     typedef _Complex float __attribute__((mode(TC))) __complex128;
     #else

?

Reply via email to