PR middle-end/78519 - missing warning for sprintf %s with null pointer
authorMartin Sebor <msebor@redhat.com>
Thu, 15 Dec 2016 04:35:31 +0000 (04:35 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Thu, 15 Dec 2016 04:35:31 +0000 (21:35 -0700)
commit2c8c83ac7737c58b5f34a277142b9a1efaf27534
tree027946fe285d26835aee90e1372257c41e6f4748
parent1750f2a55a7f17c557fa591691a15c363181fa80
PR middle-end/78519 - missing warning for sprintf %s with null pointer

gcc/ChangeLog:

PR middle-end/78519
* gimple-ssa-sprintf.c (format_string): Handle null pointers.
(format_directive): Diagnose null pointer arguments.
(pass_sprintf_length::handle_gimple_call): Diagnose null destination
pointers.  Correct location of null format string in diagnostics.

gcc/testsuite/ChangeLog:

PR middle-end/78519
* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: New test.

From-SVN: r243684
gcc/ChangeLog
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-8.c [new file with mode: 0644]