On 11/10/26 11:48 PM, Hans-Peter Nilsson wrote:
Test native x86-linux and cross to cris-elf.

Ok to commit?

Yes, ok, thanks for the fix.

Jerry>
-- >8 --
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.
---
  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