diff options
author | Martin Sebor <msebor@redhat.com> | 2017-01-08 23:42:09 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2017-01-08 16:42:09 -0700 |
commit | efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8 (patch) | |
tree | f91cdc7136d16f3e039d0ea98daf535a9c7c6f30 /gcc/tree.c | |
parent | 1243c42d6457fd2b09917b5789c8c42dd13437ec (diff) | |
download | gcc-efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8.zip gcc-efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8.tar.gz gcc-efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8.tar.bz2 |
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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -9746,10 +9746,10 @@ get_file_function_name (const char *type) file = LOCATION_FILE (input_location); len = strlen (file); - q = (char *) alloca (9 + 17 + len + 1); + q = (char *) alloca (9 + 19 + len + 1); memcpy (q, file, len + 1); - snprintf (q + len, 9 + 17 + 1, "_%08X_" HOST_WIDE_INT_PRINT_HEX, + snprintf (q + len, 9 + 19 + 1, "_%08X_" HOST_WIDE_INT_PRINT_HEX, crc32_string (0, name), get_random_seed (false)); p = q; |