[PATCH] relax lower bound for infinite arguments in gimple-ssa-sprinf.c (PR 86274)

Christophe Lyon christophe.lyon@linaro.org
Wed Jul 4 14:05:00 GMT 2018


Hi,

On Wed, 4 Jul 2018 at 09:26, Richard Biener <rguenther@suse.de> wrote:
>
> On Tue, 3 Jul 2018, Martin Sebor wrote:
>
> > Committed to trunk in r86274.  Jakub/Richard, can you please
> > also review and approve the corresponding fix for the release
> > branches?
>
> If it is a regression and the patch was approved for trunk it is
> automatically OK for release branches without further review unless
> you think it is too invasive.
>
> Richard.
>
> > Martin
> >
> > On 07/03/2018 06:32 PM, Jeff Law wrote:
> > > On 07/03/2018 04:50 PM, Martin Sebor wrote:
> > > > In computing the size of expected output for non-constant floating
> > > > arguments the sprintf pass doesn't consider the possibility that
> > > > the argument value may be not finite (i.e., it can be infinity or
> > > > NaN).  Infinities and NaNs are formatted as "inf" or "infinity"
> > > > and "nan".  As a result, any floating directive can produce as
> > > > few bytes on output as three for an non-finite argument, when
> > > > the least amount directives such as %f produce for finite
> > > > arguments is 8.
> > > >
> > > > The attached patch adjusts the floating point code to correctly
> > > > reflect the lower bound.
> > > >
> > > > Martin
> > > >
> > > > gcc-86274.diff
> > > >
> > > >
> > > > 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.

I've noticed a failure with this new test (on arm and aarch64, but
I've seen other targets are affected on gcc-testresults):
gcc.dg/tree-ssa/builtin-sprintf-9.c: dump file does not exist
UNRESOLVED: gcc.dg/tree-ssa/builtin-sprintf-9.c scan-tree-dump-times
optimized" "call_made_in_true_branch_" 6"

The test is compiled with -fdump-tree-optimized

Christophe

> > > >   * 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.
> > > OK
> > > jeff
> > >
> >
> >
>
> --
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)



More information about the Gcc-patches mailing list