From bad1faa7f5fd21a315c45cc6327cfc9874f499fb Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 7 Jul 2023 00:53:00 +0200 Subject: [PATCH] wcscmp: Work around a glibc bug. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- ChangeLog | 8 ++++++++ doc/posix-functions/wcscmp.texi | 2 ++ m4/wcscmp.m4 | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8aa54f38d8..476a88c3b5 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-04 Bruno Haible mbiter, mbfile, mbmemcasecoll: Improve handling of mbrtoc32 result. 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; } -- 2.39.5