The warning below doesn't seem justified and is not helpful (certainly not in this case or whenever the last argument can be proven to be 0). IMO, where the warning would be helpful is the second invocation of memcpy() since that one has undefined behavior.
$ cat -n t.cpp && g++ -Wall t.cpp 1 #include <string.h> 2 3 int main () 4 { 5 memcpy (0, 0, 0); 6 7 int i = 0; 8 memcpy (&i, &i, sizeof i); 9 } 10 t.cpp: In function 'int main()': t.cpp:5: warning: null argument where non-null required (argument 1) t.cpp:5: warning: null argument where non-null required (argument 2) -- Summary: unhelpful null argument warning on memcpy() Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28656