https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77690
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |WAITING Last reconfirmed| |2016-09-23 CC| |msebor at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail| |7.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Unfortunately, even though it seems like the if statement with the strlen call should help, the length range information isn't available to the warning pass. The warning can, however, be avoided by constraining the length of the string argument output by specifying the precision in the directive like so: sprintf(foo, "zz%.4s", s.buf); Please let me know if this isn't sufficient to resolve the problem report.