public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2 3/7] string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp].
Date: Mon, 10 Jan 2022 12:39:56 -0600	[thread overview]
Message-ID: <CAFUsyfLXQhoXbgR63TRknQieMH1oWre+zTVzcWJiua2GmyJzkg@mail.gmail.com> (raw)
In-Reply-To: <AS8PR08MB6534E9868247E248757BE0D183509@AS8PR08MB6534.eurprd08.prod.outlook.com>

On Mon, Jan 10, 2022 at 5:42 AM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Noah,
>
> > These implementations are incorrect. There may be a mismatch in s1/s2
> > before invalid memory but no null CHAR / length boundary.
>
> This is not true, see eg. https://en.cppreference.com/w/cpp/string/byte/strcmp.
> Most string functions require that the string is correctly terminated. There
> are only a few exceptions (memchr IIRC), and several generic implementations
> use strlen or strnlen before the main loop.
>
> So if your changes to the testsuite cause these functions to fail, I believe it will
> create failures on other targets too (eg. AArch64 strcmp does a check for zero
> and continues reading if there is no zero).
>
> It's OK to remove these weirdly named functions (I already removed them from
> the benchtests directory), however we should ensure the strings are valid to
> avoid reporting errors on existing implementations.

Good catch! Had always thought the per-byte loop that stopped on mismatch
was the functionality we had to emulate.

I'll update the commit message in V3 and make sure all the added tests
don't test this edge case.
>
> Cheers,
> Wilco

  parent reply	other threads:[~2022-01-10 18:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 11:42 Wilco Dijkstra
2022-01-10 12:42 ` Florian Weimer
2022-01-10 13:09   ` Wilco Dijkstra
2022-01-10 13:16     ` Florian Weimer
2022-01-10 13:56       ` Wilco Dijkstra
2022-01-10 18:39 ` Noah Goldstein [this message]
2022-01-10 21:38 ` Noah Goldstein
  -- strict thread matches above, loose matches on Subject: below --
2022-01-09 12:29 [PATCH v1 1/5] x86: Optimize strcmp-avx2.S and fix for [BZ# 28755] Noah Goldstein
2022-01-10  0:27 ` [PATCH v2 1/7] x86: Fix __wcsncmp_avx2 in strcmp-avx2.S " Noah Goldstein
2022-01-10  0:27   ` [PATCH v2 3/7] string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp] Noah Goldstein
2022-01-10  0:37     ` H.J. Lu

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=CAFUsyfLXQhoXbgR63TRknQieMH1oWre+zTVzcWJiua2GmyJzkg@mail.gmail.com \
    --to=goldstein.w.n@gmail.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@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).