https://gcc.gnu.org/g:695282a69cfca0f730f77be3bf504dabc790c3a7

commit r17-6152-g695282a69cfca0f730f77be3bf504dabc790c3a7
Author: Hans-Peter Nilsson <[email protected]>
Date:   Tue Nov 10 18:09:39 2026 +0000

    libgfortran: Make HAVE_ATOMIC_FETCH_ADD reflect a 64-bit integer, not int 
[PR 128618]
    
    In r17-6022-gbcf14085d8270f, conditional calls were added for applying
    __atomic_fetch_add to a uint64_t.  This broke libgfortran for 32-bit
    systems, that don't have such an operation and lack libatomic.
    Better change the configure test to check a 64-bit type.  Use
    __INT64_TYPE__ to avoid having to find and include a usable stdint.h,
    (which would require extra measures for e.g. newlib systems that
    configure and build the library together with gcc)
    
            PR libfortran/128618
            * acinclude.m4 (LIBGFOR_CHECK_ATOMIC_FETCH_ADD): Check that
            __atomic_fetch_add works on a 64-bit type, not just int.
            * configure: Regenerate.

Diff:
---
 libgfortran/acinclude.m4 | 2 +-
 libgfortran/configure    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index 890516a6aedb..044514770b33 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -49,7 +49,7 @@ dnl Check whether the target supports __atomic_fetch_add.
 AC_DEFUN([LIBGFOR_CHECK_ATOMIC_FETCH_ADD], [
   AC_CACHE_CHECK([whether the target supports __atomic_fetch_add],
                 libgfor_cv_have_atomic_fetch_add, [
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foovar = 0;]], [[
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[__INT64_TYPE__ foovar = 0;]], [[
 if (foovar <= 0) return __atomic_fetch_add (&foovar, 1, __ATOMIC_ACQ_REL);
 if (foovar > 10) return __atomic_add_fetch (&foovar, -1, 
__ATOMIC_ACQ_REL);]])],
              libgfor_cv_have_atomic_fetch_add=yes, 
libgfor_cv_have_atomic_fetch_add=no)])
diff --git a/libgfortran/configure b/libgfortran/configure
index ed2c497c7298..3e3e68a46b7d 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -32288,7 +32288,7 @@ else
 fi
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foovar = 0;
+__INT64_TYPE__ foovar = 0;
 int
 main ()
 {

Reply via email to