Fortran: Fix libfortran cannot be cross compiled [PR124286]

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.
This commit is contained in:
Jerry DeLisle
2026-02-28 17:30:41 -08:00
parent baf734f6f3
commit e13b14030a
4 changed files with 4 additions and 85 deletions

View 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)])
])

View 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

63
libgfortran/configure vendored
View File

@@ -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

View 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