]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR middle-end/87041 - -Wformat reading through null pointer on unreachable code
authorMartin Sebor <msebor@redhat.com>
Tue, 30 Oct 2018 21:58:35 +0000 (21:58 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Tue, 30 Oct 2018 21:58:35 +0000 (15:58 -0600)
commit91e3ec29af2b20d26a97b4b80c88eac9ad95e011
treed20422e7e859155af3641fb4809c1ccabcd62586
parent448af20a27c9a1706712eba8500f5f81f5f6a46d
PR middle-end/87041 - -Wformat reading through null pointer on unreachable code

gcc/ChangeLog:

PR middle-end/87041
* gimple-ssa-sprintf.c (format_directive): Use %G to include
inlining context.
(sprintf_dom_walker::compute_format_length):
Avoid setting POSUNDER4K here.
(get_destination_size): Handle null argument values.
(get_user_idx_format): New function.
(sprintf_dom_walker::handle_gimple_call): Handle all printf-like
functions, including user-defined with attribute format printf.
Use %G to include inlining context.
Set POSUNDER4K here.

gcc/c-family/ChangeLog:

PR middle-end/87041
* c-format.c (check_format_types): Avoid diagnosing null pointer
arguments to printf-family of functions.

gcc/testsuite/ChangeLog:

PR middle-end/87041
* gcc.c-torture/execute/fprintf-2.c: New test.
* gcc.c-torture/execute/printf-2.c: Same.
* gcc.c-torture/execute/user-printf.c: Same.
* gcc.dg/tree-ssa/builtin-fprintf-warn-1.c: Same.
* gcc.dg/tree-ssa/builtin-printf-2.c: Same.
* gcc.dg/tree-ssa/builtin-printf-warn-1.c: Same.
* gcc.dg/tree-ssa/user-printf-warn-1.c: Same.

From-SVN: r265648
12 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/fprintf-2.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/printf-2.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/user-printf.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-warn-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-warn-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/user-printf-warn-1.c [new file with mode: 0644]