https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning is by design. Its purpose is to detect invalid accesses at non-zero offsets to null pointers, like in the memset call below: struct S { int a, b[4]; }; void f (struct S *p) { if (p) return; memset (p->b, 0, 4 * sizeof p->b); } For now, I recommend suppressing the warning either by #pragma GCC diagnostic or by making the pointer volatile. In the future, providing an attribute to annotate constant addresses with (or extending the io() attribute supported by some targets to all targets) might be another way to avoid it.