https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83369
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2017-12-11 CC| |msebor at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. Now that the warning diagnostic supports the %G directive the warning call can be adjusted to make use of it to produce the following output. Let me post a patch with the fix. In function ‘char* my_strcpy(char*, const char*, size_t)’, inlined from ‘void test(Test*)’ at pr83369.c:32:18: pr83369.c:14:24: warning: argument 1 null where non-null expected [-Wnonnull] size_t len = strlen(src); ~~~~~~^~~~~ In file included from pr83369.c:1: /usr/include/string.h: In function ‘void test(Test*)’: /usr/include/string.h:394:15: note: in a call to function ‘size_t strlen(const char*)’ declared here extern size_t strlen (const char *__s) ^~~~~~ In function ‘char* my_strcpy(char*, const char*, size_t)’, inlined from ‘void test(Test*)’ at pr83369.c:32:18: pr83369.c:16:15: warning: argument 2 null where non-null expected [-Wnonnull] memcpy(dst, src, len + 1); ~~~~~~^~~~~~~~~~~~~~~~~~~ In file included from pr83369.c:1: /usr/include/string.h: In function ‘void test(Test*)’: /usr/include/string.h:42:14: note: in a call to function ‘void* memcpy(void*, const void*, size_t)’ declared here extern void *memcpy (void *__restrict __dest, const void *__restrict __src, ^~~~~~ In function ‘char* my_strcpy(char*, const char*, size_t)’, inlined from ‘void test(Test*)’ at pr83369.c:32:18: pr83369.c:19:15: warning: argument 2 null where non-null expected [-Wnonnull] memcpy(dst, src, size - 1); ~~~~~~^~~~~~~~~~~~~~~~~~~~ In file included from pr83369.c:1: /usr/include/string.h: In function ‘void test(Test*)’: /usr/include/string.h:42:14: note: in a call to function ‘void* memcpy(void*, const void*, size_t)’ declared here extern void *memcpy (void *__restrict __dest, const void *__restrict __src, ^~~~~~