]> Savannah Git Hosting - gnulib.git/commitdiff
wcscmp: Work around a glibc bug.
authorBruno Haible <bruno@clisp.org>
Thu, 6 Jul 2023 22:53:00 +0000 (00:53 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 19 Jul 2023 00:49:40 +0000 (02:49 +0200)
Reported by مصعب الزعبي (Mosab Al-Zoubi) <moceap@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.

ChangeLog
doc/posix-functions/wcscmp.texi
m4/wcscmp.m4

index 5eced13c36da31575146131d8cea283b7a9eecbc..bf78fce9a10da587070f93cbab0489b724c8d894 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-07-06  Bruno Haible  <bruno@clisp.org>
+
+       wcscmp: Work around a glibc bug.
+       Reported by مصعب الزعبي (Mosab Al-Zoubi) <moceap@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.
+
 2023-07-01  Paul Eggert  <eggert@cs.ucla.edu>
 
        maint.mk: Modernize stddef.h checks for C23
index bc64d28f562b8ac0745f9b70cfe9ad941f692916..2ce58db35015d76648521fd6273f1f9f4d0dd652 100644 (file)
@@ -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
 
index a3000ed27525acc0903612ba7c78d8098c13d2ae..2060da1e764a9ec1bebc9d2f97995f0ded68b1af 100644 (file)
@@ -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;
             }