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

Wilco Dijkstra Wilco.Dijkstra@arm.com
Mon Jan 10 11:42:43 GMT 2022


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.

Cheers,
Wilco


More information about the Libc-alpha mailing list