PR middle-end/79496 - call to snprintf with zero size eliminated with -Wformat-trunca...
authorMartin Sebor <msebor@redhat.com>
Tue, 14 Feb 2017 04:38:54 +0000 (04:38 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Tue, 14 Feb 2017 04:38:54 +0000 (21:38 -0700)
commitee75687bc64b31bb3561ba77d2660f90a1be4a75
tree36896367a96a517e5464186f833c9f6ee7a3df02
parentf2348577b2bfa7df6f6e8eb0ccc7865a6a6c9d09
PR middle-end/79496 - call to snprintf with zero size eliminated with -Wformat-truncation=2

gcc/ChangeLog:

PR middle-end/79496
* gimple-ssa-sprintf.c (pass_sprintf_length::handle_gimple_call): Avoid
clearing info.nowrite flag when snprintf size argument is a range.

gcc/testsuite/ChangeLog:

PR middle-end/79496
* gcc.dg/tree-ssa/builtin-snprintf-2.c: New test.

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