https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109609

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I had a look at memcmp recently in the context of PR109306 and my understanding
is that the function may but doesn't have to access all bytes from both arrays
up to the given size.
While for memchr, C17 contains:
"The implementation shall behave as if it reads the characters sequentially and
stops as soon as a matching character is found."
and my reading of that is that it has to stop reading upon reaching the match,
so in that case the read is always just up to the given size, not the whole
size.
While e.g. strchr doesn't say something similar and so it needs to be passed
valid zero terminated string and can but doesn't have to read the whole string.

Reply via email to