[PATCH v2 3/7] string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp].

Noah Goldstein goldstein.w.n@gmail.com
Mon Jan 10 21:38:08 GMT 2022


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.

Changed the commit message and updated tests so that a valid null terminator
is guaranteed for all strings. Thanks for pointing this out.

>
> Cheers,
> Wilco


More information about the Libc-alpha mailing list