https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83688
--- Comment #3 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> --- Looks that something is not working properly. I have pasted output from compilation of function in 1st post, and -Wrestrict complained only about last memcpy call. Please take a look on this. BTW, string concatenation using sprintf causes -Wformat-overflow warning, so some protection against this is present. However this message does not say anything that this is undefined behavior per C standard.