This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/78913] Probably misleading error reported by -Wformat-length


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).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]