PR tree-optimization/86274 - SEGFAULT when logging std::to_string(NAN)
authorMartin Sebor <msebor@redhat.com>
Wed, 4 Jul 2018 02:19:35 +0000 (02:19 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 4 Jul 2018 02:19:35 +0000 (20:19 -0600)
commit7af7cb515f8ee1af63f7998c2748281263ae6f48
tree798819af04347e5a75794a0189e84ed327e7e467
parent68a8b147efe9b919ace0b05c879697a3314fdca6
PR tree-optimization/86274 - SEGFAULT when logging std::to_string(NAN)

gcc/ChangeLog:

PR tree-optimization/86274
* gimple-ssa-sprintf.c (fmtresult::type_max_digits): Verify
precondition.
(format_floating): Correct handling of infinities and NaNs.

gcc/testsuite/ChangeLog:

PR tree-optimization/86274
* gcc.dg/tree-ssa/builtin-sprintf-9.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
* gcc.dg/tree-ssa/builtin-sprintf-warn-10.c: Same.
* gcc.dg/tree-ssa/builtin-sprintf-warn-15.c: Same.
* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Same.
* gcc.dg/tree-ssa/builtin-sprintf.c: Same.
* gcc.dg/tree-ssa/pr83198.c: Same.

From-SVN: r262368
gcc/ChangeLog
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/builtin-sprintf.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.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-10.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-7.c
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
gcc/testsuite/gcc.dg/tree-ssa/pr83198.c