PR tree-optimization/88993 - GCC 9 -Wformat-overflow=2 should reflect real libc limits
authorMartin Sebor <msebor@gcc.gnu.org>
Fri, 22 Feb 2019 17:38:11 +0000 (10:38 -0700)
committerMartin Sebor <msebor@gcc.gnu.org>
Fri, 22 Feb 2019 17:38:11 +0000 (10:38 -0700)
commiteb319c505d0bc3497170b5cdaeaf774a67594ae3
tree3672c9247aa57526186defef4ad821df6a89c49d
parentcfed471a5612a925d55dae4085aa10d230bf4494
PR tree-optimization/88993 - GCC 9 -Wformat-overflow=2 should reflect real libc limits

PR tree-optimization/88993 - GCC 9 -Wformat-overflow=2 should reflect real libc limits
PR tree-optimization/88835 - overly aggressive -Werror=format-overflow for printf

gcc/ChangeLog:

PR tree-optimization/88993
PR tree-optimization/88853
* gimple-ssa-sprintf.c (sprintf_dom_walker::call_info::is_file_func):
New helper.
(sprintf_dom_walker::call_info::is_string_func): New helper.
(format_directive): Only issue "may exceed" 4095/INT_MAX warnings
for formatted string functions.
(sprintf_dom_walker::handle_gimple_call): Fix a typo in a comment.

gcc/testsuite/ChangeLog:

PR tree-optimization/88993
PR tree-optimization/88853
* gcc.dg/tree-ssa/builtin-fprintf-warn-2.c: New test.
* gcc.dg/tree-ssa/builtin-printf-warn-2.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-warn-3.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-18.c: Same.

From-SVN: r269125
gcc/gimple-ssa-sprintf.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-warn-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-warn-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-3.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c