]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: Fix libfortran cannot be cross compiled [PR124286]
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 1 Mar 2026 01:30:41 +0000 (17:30 -0800)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 1 Mar 2026 02:32:17 +0000 (18:32 -0800)
Remove unneeded check for a sane CLZL and regenerate using
the correct version of autoconf.

PR fortran/124286

libgfortran/ChangeLog:

* acinclude.m4: Remove LIBGFOR_CHECK_SANE_BUILTIN_CLZL.
* caf/shmem/allocator.c (next_power_of_two): Use known sane
builtin.
* configure: Regenerate.
* configure.ac: Remove use of LIBGFOR_CHECK_SANE_BUILTIN_CLZL.

libgfortran/acinclude.m4
libgfortran/caf/shmem/allocator.c
libgfortran/configure
libgfortran/configure.ac

index 13097b4ab926bf6d07f02c4d4bc5a75693b8c947..239ab71475066e3254eea443ecc2a4547c223ea4 100644 (file)
@@ -579,14 +579,3 @@ main ()
   fi
 ])
 
-AC_DEFUN([LIBGFOR_CHECK_SANE_BUILTIN_CLZL], [
-  AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-      int main()
-      {
-       return __builtin_clzl(256) != 8;
-      }]], [[]])],
-    AC_DEFINE(HAVE_SANE_BUILTIN_CLZL, 1,
-      [Define if __builtin_clzl behaves as expected.])
-    AM_CONDITIONAL([HAVE_SANE_BUILTIN_CLZL],true),
-    [AM_CONDITIONAL([HAVE_SANE_BUILTIN_CLZL],false)])
-])
index bd88f33e2000eeda2822496b1b41f0f863fa684a..795647cdbba1e2d1ea02a37c1983e9b39e2fb285 100644 (file)
@@ -78,16 +78,8 @@ allocator_init_supervisor (allocator *a, allocator_shared *s, shared_memory sm)
 static size_t
 next_power_of_two (size_t size)
 {
-#ifdef HAVE_SANE_BUILTIN_CLZL
-  assert (size);
-#if (__INTPTR_WIDTH__ == 64)
-  return 1 << (VOIDP_BITS - __builtin_clzl (size - 1));
-#else
-  return 1 << (VOIDP_BITS - __builtin_clz (size - 1));
-#endif
-#else
-  return 1 << (int)ceil(log2(size));
-#endif
+  assert (size != 1);
+  return (size_t)1 << (__SIZEOF_LONG_LONG__ * __CHAR_BIT__ - __builtin_clzll (size - 1));
 }
 
 shared_mem_ptr
index 41bc382ac4d5c18f3a7a6d1ae04f7524a54e4627..eeb1bce0944e811e81dad4c3337c0f553b5f7f79 100755 (executable)
@@ -637,8 +637,6 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 get_gcc_base_ver
-HAVE_SANE_BUILTIN_CLZL_FALSE
-HAVE_SANE_BUILTIN_CLZL_TRUE
 HAVE_AVX128_FALSE
 HAVE_AVX128_TRUE
 tmake_file
@@ -13247,6 +13245,8 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
+
+
 #line 13250 "configure"
 #include "confdefs.h"
 
@@ -32517,57 +32517,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   CFLAGS="$ac_save_CFLAGS"
 
 
-# Check if __builtin_clzl behaves (it doesn't on Msys2/ucrt64).
-
-  if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-      int main()
-      {
-       return __builtin_clzl(256) != 8;
-      }
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-$as_echo "#define HAVE_SANE_BUILTIN_CLZL 1" >>confdefs.h
-
-     if true; then
-  HAVE_SANE_BUILTIN_CLZL_TRUE=
-  HAVE_SANE_BUILTIN_CLZL_FALSE='#'
-else
-  HAVE_SANE_BUILTIN_CLZL_TRUE='#'
-  HAVE_SANE_BUILTIN_CLZL_FALSE=
-fi
-
-else
-   if false; then
-  HAVE_SANE_BUILTIN_CLZL_TRUE=
-  HAVE_SANE_BUILTIN_CLZL_FALSE='#'
-else
-  HAVE_SANE_BUILTIN_CLZL_TRUE='#'
-  HAVE_SANE_BUILTIN_CLZL_FALSE=
-fi
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-
 # Determine what GCC version number to use in filesystem paths.
 
   get_gcc_base_ver="cat"
@@ -32863,14 +32812,6 @@ if test -z "${HAVE_AVX128_TRUE}" && test -z "${HAVE_AVX128_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_AVX128\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${HAVE_SANE_BUILTIN_CLZL_TRUE}" && test -z "${HAVE_SANE_BUILTIN_CLZL_FALSE}"; then
-  as_fn_error $? "conditional \"HAVE_SANE_BUILTIN_CLZL\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${HAVE_SANE_BUILTIN_CLZL_TRUE}" && test -z "${HAVE_SANE_BUILTIN_CLZL_FALSE}"; then
-  as_fn_error $? "conditional \"HAVE_SANE_BUILTIN_CLZL\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
index fea8292225be49faefc3400aeff90116b645655a..530d15f0152b57376a02a011b894ab7af7b4f590 100644 (file)
@@ -799,9 +799,6 @@ LIBGFOR_CHECK_FMA4
 # Check if AVX128 works
 LIBGFOR_CHECK_AVX128
 
-# Check if __builtin_clzl behaves (it doesn't on Msys2/ucrt64).
-LIBGFOR_CHECK_SANE_BUILTIN_CLZL
-
 # Determine what GCC version number to use in filesystem paths.
 GCC_BASE_VER