PR tree-optimization/78913 - Probably misleading error reported by
-Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf
gcc/c-family/ChangeLog:
PR tree-optimization/78913
PR middle-end/77708
* c.opt (-Wformat-truncation): New option.
gcc/testsuite/ChangeLog:
PR tree-optimization/78913
PR middle-end/77708
* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
due to bug 78969.
gcc/ChangeLog:
PR tree-optimization/78913
PR middle-end/77708
* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
New member functions.
(format_directive): Used them.
(add_bytes): Sam
(pass_sprintf_length::handle_gimple_call): Same.
OK.
jeff
Thanks. The option exposed a few instances of possible unchecked
truncation in GCC that I had missed, most likely because I'd looked
at the test results for one of my other patches by mistake. Since
the fixes were all trivial and involved increasing local buffers by
a few bytes I committed the result in r244210 without posting the
updated patch for review first.
Martin