PR middle-end/79692 - [7 Regression] -Wformat-overflow false positive
authorMartin Sebor <msebor@redhat.com>
Wed, 1 Mar 2017 23:39:59 +0000 (23:39 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 1 Mar 2017 23:39:59 +0000 (16:39 -0700)
commit71dedb336f2cbcfa71ca3ed2d153ebd4eb6e9389
tree28ec2ca75443c8ea750c038f35b7ff911bc6d702
parent538d7dba84ff54f8be6632797f4e636d7af0a734
PR middle-end/79692 - [7 Regression] -Wformat-overflow false positive

gcc/ChangeLog:

PR middle-end/79692
* gimple-ssa-sprintf.c
(directive::known_width_and_precision): New function.
(format_integer): Use it.
(get_mpfr_format_length): Consider the full range of precision
when computing %g output with the # flag.  Set the likely byte
count to 3 rather than 1 when precision is indeterminate.
(format_floating): Correct the lower bound of precision.

gcc/testsuite/ChangeLog:

PR middle-end/79692
* gcc.dg/tree-ssa/builtin-sprintf-2.c: Add test cases.
* gcc.dg/tree-ssa/builtin-sprintf-warn-10.c: Correct %#g.
* gcc.dg/tree-ssa/builtin-sprintf-warn-15.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-3.c: Ditto.

From-SVN: r245822
gcc/ChangeLog
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c [new file with mode: 0644]