This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/78913] Probably misleading error reported by -Wformat-length
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 01 Jan 2017 18:51:48 +0000
- Subject: [Bug tree-optimization/78913] Probably misleading error reported by -Wformat-length
- Auto-submitted: auto-generated
- References: <bug-78913-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78913
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #4)
> 1) use the %.508s directive instead of %s, or
> 2) verify the snprintf return value is less than 512.
Whoops. An off-by-one error. I meant to follow that by:
> Of the two alternatives, (1) is the expected/recommended way to avoid both
> the truncation and the warning. (2) is a possible enhancement that could
> also be used to suppress the warning (along with changing the code).