re PR tree-optimization/86853 (sprintf optimization for wide strings doesn't account...
authorMartin Sebor <msebor@redhat.com>
Fri, 17 Aug 2018 04:01:14 +0000 (04:01 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 17 Aug 2018 04:01:14 +0000 (22:01 -0600)
commitbbcbd744b80c2cd40d7ef41d32dbd6ee7400701f
tree41aaf431ca5d1badf20f6186830991a73761cee6
parente584cd3509e56990aaf64b7e0b28881051483cb5
re PR tree-optimization/86853 (sprintf optimization for wide strings doesn't account for conversion failure)

gcc/ChangeLog:

PR tree-optimization/86853
* gimple-ssa-sprintf.c (struct format_result): Rename member.
(struct fmtresult): Add member and initialize it in ctors.
(format_character): Handle %C.  Extend range to NUL.  Set MAYFAIL.
(format_string): Handle %S the same as %ls.  Set MAYFAIL.
(format_directive): Set POSUNDER4K when MAYFAIL is set.
(parse_directive): Handle %C same as %c.
(sprintf_dom_walker::compute_format_length): Adjust.
(is_call_safe): Adjust.

gcc/testsuite/ChangeLog:

PR tree-optimization/86853
* gcc.dg/tree-ssa/builtin-sprintf-10.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-11.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-18.c: Adjust.

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