https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107754
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-11-18 Ever confirmed|0 |1 Summary|Confusing -Warray-bounds |Confusing -Warray-bounds |warning with strcpy |warning with strcpy with a | |null pointer Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. Note the warning message is correct; just confusing and does not mention a null pointer here. Reduced further: struct Foo { unsigned int a; char bar[1024]; }; void setFoo(const char * value) { struct Foo * ptr = 0; __builtin_strcpy(ptr->bar, value); } ---- CUT --- Since the offset for the character array is non-zero, we see a non-zero constant and (based on other settings) assume it is the null pointer page and we get a size of 0 (which is ok) but don't mention a null pointer. There might be other dups of this but I am not going to search for it right now.