https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94626
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The warning documentation should mention it if it doesn't already, but the warning shouldn't, it is far more likely that the problem is just in misusing strncpy, at which point nostring attribute is the wrong thing to do. Your case is quite an exception, usually when people use strncpy they really shouldn't use it, because either if the src is shorter, they will uselessly fill the remainder of the buffer with zeros which they don't really need, and if it is too long, there won't be zero termination.