https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84480
--- Comment #1 from Romain Geissler <romain.geissler at amadeus dot com> --- Hi, I looked at the code. Actually all happens in tree-ssa-strlen.c, you have both handle_builtin_stxncpy and maybe_diag_stxncpy_trunc. It happens that the logic where you look at the next statement to check if its like "array[arraySize -1] = '\0' is only implemented in maybe_diag_stxncpy_trunc. Somehow the very same logic should be implemented in handle_builtin_stxncpy around line 2103 where you throw this warning. Cheers, Romain