Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-08-27 Thread Martin Sebor
On 8/27/19 3:09 AM, Christophe Lyon wrote: On Fri, 23 Aug 2019 at 04:14, Jeff Law wrote: On 8/12/19 4:09 PM, Martin Sebor wrote: gcc-83431.diff PR tree-optimization/83431 - -Wformat-truncation may incorrectly report truncation gcc/ChangeLog: PR c++/83431 *

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-08-27 Thread Christophe Lyon
On Fri, 23 Aug 2019 at 04:14, Jeff Law wrote: > > On 8/12/19 4:09 PM, Martin Sebor wrote: > > > > > gcc-83431.diff > > > > PR tree-optimization/83431 - -Wformat-truncation may incorrectly report > > truncation > > > > gcc/ChangeLog: > > > > PR c++/83431 > > * gimple-ssa-sprintf.c

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-08-22 Thread Jeff Law
On 8/12/19 4:09 PM, Martin Sebor wrote: > > gcc-83431.diff > > PR tree-optimization/83431 - -Wformat-truncation may incorrectly report > truncation > > gcc/ChangeLog: > > PR c++/83431 > * gimple-ssa-sprintf.c (pass_data_sprintf_length): Remove object. >

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-08-09 Thread Jeff Law
On 7/10/19 5:54 PM, Martin Sebor wrote: >> So if I'm reading things correctly, it appears gimple-ssa-sprintf.c is >> no longer a distinct pass.  Instead it co-exists with the strlen pass. >> Right? > > Yes.  strlen just calls into sprintf to handle the calls. OK. Just wanted to make sure I

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-08-09 Thread Jeff Law
On 7/1/19 7:47 PM, Martin Sebor wrote: > > Jeff, I looked into your question/suggestion for me last week > when we spoke, to introduce some sort of a recursion limit for > get_range_strlen_dynamic.  It's easily doable but before we go > down that path I did some testing to see how bad it can get

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-11 Thread Martin Sebor
... We've already touched on the need to limit the backwards walk out of this code. Limiting based on the product of # phi args * number of phis visited, recursion depth, or number of SSA_NAME_DEF_STMTs visited all seem reasonable to me. I do think Richi's suggestion for figuring out a

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-11 Thread Jakub Jelinek
On Thu, Jul 11, 2019 at 11:11:58AM +0200, Richard Biener wrote: > The others all smell like they might be yours ;) (besides object-size > maybe but that one is limited by having a cache - hopefully also > used when not used in the compute-everything mode). objsz doesn't really have a compute

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-11 Thread Richard Biener
On Thu, Jul 11, 2019 at 1:54 AM Martin Sebor wrote: > > On 7/2/19 4:38 PM, Jeff Law wrote: > > On 7/1/19 7:47 PM, Martin Sebor wrote: > >> Attached is a more complete solution that fully resolves the bug > >> report by avoiding a warning in cases like: > >> > >>char a[32], b[8]; > >> > >>

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-10 Thread Martin Sebor
On 7/2/19 4:38 PM, Jeff Law wrote: On 7/1/19 7:47 PM, Martin Sebor wrote: Attached is a more complete solution that fully resolves the bug report by avoiding a warning in cases like:   char a[32], b[8];   void f (void)   { if (strlen (a) < sizeof b - 2)   snprintf (b, sizeof b, 

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-10 Thread Martin Sebor
On 7/2/19 3:59 AM, Richard Biener wrote: On Tue, Jul 2, 2019 at 3:48 AM Martin Sebor wrote: Attached is a more complete solution that fully resolves the bug report by avoiding a warning in cases like: char a[32], b[8]; void f (void) { if (strlen (a) < sizeof b - 2)

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-02 Thread Jeff Law
On 7/1/19 7:47 PM, Martin Sebor wrote: > Attached is a more complete solution that fully resolves the bug > report by avoiding a warning in cases like: > >   char a[32], b[8]; > >   void f (void) >   { > if (strlen (a) < sizeof b - 2) >   snprintf (b, sizeof b, "b=%s", a); // no 

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-02 Thread Jeff Law
On 7/2/19 3:59 AM, Richard Biener wrote: > On Tue, Jul 2, 2019 at 3:48 AM Martin Sebor wrote: >> >> Attached is a more complete solution that fully resolves the bug >> report by avoiding a warning in cases like: >> >>char a[32], b[8]; >> >>void f (void) >>{ >> if (strlen (a) <

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-02 Thread Richard Biener
On Tue, Jul 2, 2019 at 3:48 AM Martin Sebor wrote: > > Attached is a more complete solution that fully resolves the bug > report by avoiding a warning in cases like: > >char a[32], b[8]; > >void f (void) >{ > if (strlen (a) < sizeof b - 2) >snprintf (b, sizeof b, "b=%s",

Re: [PATCH] integrate sprintf pass into strlen (PR 83431)

2019-07-01 Thread Martin Sebor
Attached is a more complete solution that fully resolves the bug report by avoiding a warning in cases like: char a[32], b[8]; void f (void) { if (strlen (a) < sizeof b - 2) snprintf (b, sizeof b, "b=%s", a); // no -Wformat-truncation } It does that by having