PR middle-end/78786 - GCC hangs/out of memory calling sprintf with large precision
authorMartin Sebor <msebor@redhat.com>
Wed, 14 Dec 2016 21:58:19 +0000 (21:58 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 14 Dec 2016 21:58:19 +0000 (14:58 -0700)
commitcfce1a4a42a9f76477e732fbe7408459742a92a2
treee743e6d8a689f55f3c3234066fdbbf8b2306b7d7
parent8000827901d090f62414ff75203e03b00acd4ca5
PR middle-end/78786 - GCC hangs/out of memory calling sprintf with large precision

gcc/ChangeLog:

PR middle-end/78786
* gimple-ssa-sprintf.c (target_dir_max): New macro.
(get_mpfr_format_length): New function.
(format_integer): Use HOST_WIDE_INT instead of int.
(format_floating_max): Same.
(format_floating): Call get_mpfr_format_length.
(format_directive): Use target_dir_max.

gcc/testsuite/ChangeLog:

PR middle-end/78786
* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: New test.

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