From: Bruno Haible Date: Thu, 6 Jul 2023 22:53:00 +0000 (+0200) Subject: wcscmp: Work around a glibc bug. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9f5fbf7ec886668687e394f6a65dd46f4ef3f1fd;p=gnulib.git wcscmp: Work around a glibc bug. Reported by مصعب الزعبي (Mosab Al-Zoubi) in . * 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/ChangeLog b/ChangeLog index 5eced13c36..bf78fce9a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-07-06 Bruno Haible + + wcscmp: Work around a glibc bug. + Reported by مصعب الزعبي (Mosab Al-Zoubi) in + . + * m4/wcscmp.m4 (gl_FUNC_WCSCMP): Test against a glibc/arm* bug. + * doc/posix-functions/wcscmp.texi: Mention the glibc/arm* bug. + 2023-07-01 Paul Eggert maint.mk: Modernize stddef.h checks for C23 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 @@ glibc 2.14.1 on x86 or x86_64, musl libc 1.2.3, macOS 12.5, FreeBSD 13.2, NetBSD @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; }