Mosab Al-Zoubi <moc...@hotmail.com> wrote: > Please see the bug at RHBZ: > > https://bugzilla.redhat.com/show_bug.cgi?id=2220874
Thanks for the report. I have reported a bug upstream in glibc https://sourceware.org/bugzilla/show_bug.cgi?id=30620 and added a workaround in gnulib. 2023-07-06 Bruno Haible <br...@clisp.org> wcscmp: Work around a glibc bug. Reported by مصعب الزعبي (Mosab Al-Zoubi) <moc...@hotmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00029.html>. * m4/wcscmp.m4 (gl_FUNC_WCSCMP): Test against a glibc/arm* bug. * doc/posix-functions/wcscmp.texi: Mention the glibc/arm* bug. diff --git a/doc/posix-functions/wcscmp.texi b/doc/posix-functions/wcscmp.texi index bc64d28f56..2ce58db350 100644 --- a/doc/posix-functions/wcscmp.texi +++ b/doc/posix-functions/wcscmp.texi @@ -15,6 +15,8 @@ @item This function may return a wrong result if the two arguments are of different length, on some platforms: +@c https://sourceware.org/bugzilla/show_bug.cgi?id=30620 +glibc 2.37 on arm and arm64 CPUs, AIX 7.2 in 64-bit mode. @end itemize diff --git a/m4/wcscmp.m4 b/m4/wcscmp.m4 index a3000ed275..2060da1e76 100644 --- a/m4/wcscmp.m4 +++ b/m4/wcscmp.m4 @@ -1,4 +1,4 @@ -# wcscmp.m4 serial 3 +# wcscmp.m4 serial 4 dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,6 +33,10 @@ AC_DEFUN([gl_FUNC_WCSCMP] int cmp = wcscmp (c, d); if (!((wchar_t)-1 < 0 ? cmp > 0 : cmp < 0)) result |= 2; + /* This test fails on glibc 2.37 on arm and arm64 CPUs. */ + cmp = wcscmp (d, c); + if (!((wchar_t)-1 < 0 ? cmp < 0 : cmp > 0)) + result |= 4; } return result; }