re PR tree-optimization/79327 (wrong code at -O2 and -fprintf-return-value)
authorJakub Jelinek <jakub@redhat.com>
Fri, 3 Feb 2017 19:16:39 +0000 (20:16 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 3 Feb 2017 19:16:39 +0000 (20:16 +0100)
commit5b00f9d236e181c3ef427989126009f21243a007
tree354ee345451eb296eb87adff9df1b1c87ad8b2ef
parentb333e8ebb0d4b63acd52249b350de410e6f77e5f
re PR tree-optimization/79327 (wrong code at -O2 and -fprintf-return-value)

PR tree-optimization/79327
* gimple-ssa-sprintf.c (adjust_range_for_overflow): If returning
true, always set *argmin and *argmax to TYPE_{MIN,MAX}_VALUE of
dirtype.
(format_integer): Use wide_int_to_tree instead of build_int_cst
+ to_?hwi.  If argmin is NULL, just set argmin and argmax to
TYPE_{MIN,MAX}_VALUE of argtype.  Simplify and fix computation
of shortest and longest sequence.

* gcc.dg/tree-ssa/pr79327.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
(test_sprintf_chk_hh_nonconst): Don't expect 2 bogus warnings.
* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
(test_sprintf_chk_range_schar): Adjust dg-message.
* gcc.dg/tree-ssa/builtin-sprintf-warn-12.c: New test.
* gcc.c-torture/execute/pr79327.c: New test.

Co-Authored-By: Martin Sebor <msebor@redhat.com>
From-SVN: r245166
gcc/ChangeLog
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr79327.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-12.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
gcc/testsuite/gcc.dg/tree-ssa/pr79327.c [new file with mode: 0644]