public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bruno at clisp dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug string/30620] New: wcscmp bug on platforms with unsigned wchar_t
Date: Thu, 06 Jul 2023 21:59:46 +0000	[thread overview]
Message-ID: <bug-30620-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30620

            Bug ID: 30620
           Summary: wcscmp bug on platforms with unsigned wchar_t
           Product: glibc
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: bruno at clisp dot org
  Target Milestone: ---

Created attachment 14956
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14956&action=edit
test case testt-wcscmp.c

When we have two wide-character strings such that wcscmp (input1, input2) < 0,
obviously we should have wcscmp (input2, input1) > 0. This is not the case on
glibc on platforms which have an unsigned 'wchar_t' type (such as aarch64).

On platforms with a signed 'wchar_t' type (such as alpha), there is no problem.

How to reproduce: On a Linux/aarch64 machine, such as gcc185.fsffrance.org, run
the attached program:
$ gcc test-wcscmp.c
$ ./a.out 

Expected behaviour: Successful termination.

Actual behaviour:
test-wcscmp.c:107: assertion 'wcscmp (input2, input1) > 0' failed
Aborted (core dumped)

The problematic source code appears to be in the file glibc/wcsmbs/wcscmp.c .

The function wcsncmp, OTOH, works fine.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-07-06 21:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 21:59 bruno at clisp dot org [this message]
2023-07-06 22:00 ` [Bug string/30620] " bruno at clisp dot org
2023-07-06 22:43 ` bruno at clisp dot org
2023-07-07  8:23 ` schwab@linux-m68k.org
2023-07-07  9:12 ` bruno at clisp dot org
2023-07-07  9:45 ` schwab@linux-m68k.org
2023-07-07 10:01 ` bruno at clisp dot org
2023-07-07 10:11 ` schwab@linux-m68k.org
2023-07-18 15:57 ` joseph at codesourcery dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30620-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).