This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.
> > > 	* 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]