https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83106
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2017-11-22 Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 42678 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42678&action=edit gcc8-pr83106.patch I think the warning is just bogus for strncat. Unlike strncpy, which is weird, sometimes doesn't terminate, sometimes unnecessarily fills with zeros and the third argument represents the size of the destination (so indeed specifying the size based on strlen of the source might be a bug), strncat does something different, the third argument is the max number of chars to take from the src string; and strncat always terminates. So, passing strlen (src) as third argument is nothing problematic, it is just another way of specifying strcat, or using something strlen based is sane too (both smaller or larger). That said, the code in target.c is ugly and relies on tree-ssa-strlen.c pass to fix the mess up, so I'll test and commit the attached patch.