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

            Bug ID: 106777
           Summary: Permit TFmode (real(16)/float128) in gfortran if GLIBC
                    supports it and --disable-libquadmath(-support)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Currently, a lot of code requires that libquadmath building and usage is
enabled to
to support TFmode 'real(16)' in gfortran.

Those are enabled by default (if supportable) but can be disabled by an
explicit
--disable-libquadmath or --disable-libquadmath-support
→ https://gcc.gnu.org/install/configure.html


However, newer GLIBC support this type directly, making libquadmath obsolete.
→  https://gcc.gnu.org/r13-1324-g133d0d422ebd18dbd215cfa5394aff9f938e7060

Thus, if supported by GLIBC, REAL(16)* could be still supported even if
libquadmath is not build.  (*on x86_64; PowerPC has additional kind values.)

 * * *

However, there is a lot of code which checks for libquadmath such that
disabling
it will also disable READ(16), even if it could be supported.

One possible first but insufficient patch would be the following.
(I have not checked whether the conditions are correct), but much more is
required:


--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -442,9 +442,12 @@ gfc_init_kinds (void)
        continue;
       if (mode != TYPE_MODE (float_type_node)
            && (mode != TYPE_MODE (double_type_node))
            && (mode != TYPE_MODE (long_double_type_node))
-#if defined(HAVE_TFmode) && defined(ENABLE_LIBQUADMATH_SUPPORT)
+#if defined(HAVE_TFmode) \
+    && (defined(ENABLE_LIBQUADMATH_SUPPORT) \
+       || TARGET_GLIBC_MAJOR > 2 \
+       || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 26))
            && (mode != TFmode)
 #endif
           )
        continue;

Reply via email to