https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111615
--- Comment #6 from Ben Gardner ---
(In reply to Andrew Pinski from comment #5)
> extern void *memmem (const void *__haystack, size_t __haystacklen,
>const void *__needle, size_t __needlelen)
> __attribute__ ((__nothrow__ , __leaf__
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111615
--- Comment #3 from Ben Gardner ---
The issue isn't with memmem(). It is with the value passed into pr_str() from
the structure. I suspect memmem() is a distraction.
I'll try to further reduce the test case to eliminate memmem(), if possible.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111615
--- Comment #1 from Ben Gardner ---
Created attachment 56004
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56004&action=edit
Build script.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111615
Bug ID: 111615
Summary: NULL check incorrectly skipped at O2 and O3
Product: gcc
Version: 11.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c