[Bug c/77690] -Wformat-length %s false positive after strlen check

nsz at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 23 10:54:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77690

--- Comment #2 from nsz at gcc dot gnu.org ---
(In reply to Martin Sebor from comment #1)
>   sprintf(foo, "zz%.4s", s.buf);
> 
> Please let me know if this isn't sufficient to resolve the problem report.

in my case truncation is fatal error so using precision is not useful (other
than suppressing the warning) and has a runtime cost (extra arg passing for
%.*s).


More information about the Gcc-bugs mailing list