https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111615
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Anything passed to memmem (or memcmpy, or memcpy, etc.) is considered to be a non-null pointer, because that's a requirement of those functions. And so if it's a non-null pointer, any null checks for it can be removed.