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

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #3)
> The big question is what is the C standard requirement here for memchr, is
> it that all of the array from 0...size needs to be valid or not? I think the
> standard does say that and requires that.

It does, in case the char is not found within the array object searched by
memchr.

It does not, in case the char is found within the array object searched by
memchr.

AFAIC, this distinction is confusing and error-prone, which is why I'm
personally in favor of keeping the warning as is, but the documentation doesn't
indicate that it also warns for well-defined programs that do not read past the
end of the source sequence.

Reply via email to