https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81117
--- Comment #12 from Dmitry G. Dyachenko <dimhen at gmail dot com> --- char *strncpy(char *dest, const char *src, size_t n); void foo(char* p) { strncpy(p, "1", 1); p[1] = 0; } with gcc8/r254663 is this expected? $ gcc -c -Wall x.c x.c: In function ‘foo’: x.c:4:5: warning: ‘strncpy’ output truncated before terminating nul copying 1 byte from a string of the same length [-Wstringop-truncation] strncpy(p, "1", 1); ^~~~~~~~~~~~~~~~~~