PR tree-optimization/79327 - wrong code at -O2 and -fprintf-return-value
authorMartin Sebor <msebor@redhat.com>
Fri, 3 Feb 2017 22:47:35 +0000 (22:47 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Fri, 3 Feb 2017 22:47:35 +0000 (15:47 -0700)
commitf589a1ce25d8320f4dc552b91949181edd616b64
tree1461f1a2bcdcc21ca51798e6997b3e9b269b555f
parent77095a6ab13996a38b0a360d8ef9fc6cc6bc5234
PR tree-optimization/79327 - wrong code at -O2 and -fprintf-return-value

PR tree-optimization/79327 - wrong code at -O2 and -fprintf-return-value
gcc/ChangeLog:
* gimple-ssa-sprintf.c (tree_digits): Avoid adding the base prefix
when precision has resulted in leading zeros.
(format_integer): Adjust the likely counter to assume an unknown
argument that may be zero is non-zero.

gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
* gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c: New test.
* gcc/testsuite/gcc.dg/tree-ssa/pr79327-2.c: Ditto.

From-SVN: r245173
gcc/ChangeLog
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr79327-2.c [new file with mode: 0644]