PR middle-end/78521 - [7 Regression] incorrect byte count in -Wformat-length...
authorMartin Sebor <msebor@redhat.com>
Mon, 28 Nov 2016 21:41:41 +0000 (21:41 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Mon, 28 Nov 2016 21:41:41 +0000 (14:41 -0700)
commitde6aa93370b68a9fbcf874de8a97c5d1469b7d46
tree40efd43f50949c76463ec5e2f1c7e062a2449dc9
parentb3a5bff4d709c8b8c6492747ef8104fb88a481b3
PR middle-end/78521 - [7 Regression] incorrect byte count in -Wformat-length...

PR middle-end/78521 - [7 Regression] incorrect byte count in -Wformat-length warning with non-constant width or precision
PR middle-end/78520 - missing warning for snprintf with size greater than INT_MAX

gcc/ChangeLog:

PR middle-end/78520
* gimple-ssa-sprintf.c (target_max_value): Remove.
(target_int_max, target_size_max): Use TYPE_MAX_VALUE.
(get_width_and_precision): New function.
(format_integer, format_floating, get_string_length, format_string):
Correct handling of width and precision with unknown value.
(format_directive): Add warning.
(pass_sprintf_length::compute_format_length): Allow for precision
to consist of a sole period with no asterisk or digits after it.

gcc/testsuite/ChangeLog:

PR middle-end/78520
* gcc.dg/tree-ssa/builtin-sprintf-5.c: Add test cases.
* gcc.dg/tree-ssa/builtin-sprintf-6.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases.
* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Add test cases.

From-SVN: r242935
gcc/ChangeLog
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-5.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c