PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
authorMartin Sebor <msebor@redhat.com>
Sun, 8 Jan 2017 23:42:09 +0000 (23:42 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Sun, 8 Jan 2017 23:42:09 +0000 (16:42 -0700)
commitefcc8d387f52f995a6e41bc78a76cc77e4bb6ee8
treef91cdc7136d16f3e039d0ea98daf535a9c7c6f30
parent1243c42d6457fd2b09917b5789c8c42dd13437ec
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length

PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

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): Same.
(pass_sprintf_length::handle_gimple_call): Same.
* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
to avoid truncation for any argument.
(extract_affine_mul): Same.
* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

PR middle-end/77708
* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

PR tree-optimization/78913
PR middle-end/77708
* trans-common.c (build_equiv_decl): Increase buffer size to avoid
truncation for any argument.
* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

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.dg/format/pr78569.c: Adjust.

From-SVN: r244210
15 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/doc/invoke.texi
gcc/fortran/ChangeLog
gcc/fortran/trans-common.c
gcc/fortran/trans-types.c
gcc/gimple-ssa-sprintf.c
gcc/graphite-sese-to-poly.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/pr78569.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-6.c
gcc/tree.c