Re: [PATCH] add support for strnlen (PR 81384)

2018-07-10 Thread Martin Sebor
On 07/10/2018 08:34 AM, Jeff Law wrote: On 07/10/2018 08:25 AM, Richard Biener wrote: On Tue, Jul 10, 2018 at 4:10 PM Martin Sebor wrote: On 07/10/2018 01:12 AM, Richard Biener wrote: On Mon, Jul 9, 2018 at 11:26 PM Martin Sebor wrote: On 07/09/2018 08:36 AM, Aldy Hernandez wrote: { d

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-10 Thread Jeff Law
On 07/10/2018 08:25 AM, Richard Biener wrote: > On Tue, Jul 10, 2018 at 4:10 PM Martin Sebor wrote: >> >> On 07/10/2018 01:12 AM, Richard Biener wrote: >>> On Mon, Jul 9, 2018 at 11:26 PM Martin Sebor wrote: On 07/09/2018 08:36 AM, Aldy Hernandez wrote: >{ dg-do run } >{

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-10 Thread Richard Biener
On Tue, Jul 10, 2018 at 4:10 PM Martin Sebor wrote: > > On 07/10/2018 01:12 AM, Richard Biener wrote: > > On Mon, Jul 9, 2018 at 11:26 PM Martin Sebor wrote: > >> > >> On 07/09/2018 08:36 AM, Aldy Hernandez wrote: > >>>{ dg-do run } > >>>{ do-options "-O2 -fno-tree-strlen" } */ > >>> > >

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-10 Thread Martin Sebor
On 07/10/2018 01:12 AM, Richard Biener wrote: On Mon, Jul 9, 2018 at 11:26 PM Martin Sebor wrote: On 07/09/2018 08:36 AM, Aldy Hernandez wrote: { dg-do run } { do-options "-O2 -fno-tree-strlen" } */ I don't think this is doing anything. If you look at the test run you can see th

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-10 Thread Richard Biener
On Mon, Jul 9, 2018 at 11:26 PM Martin Sebor wrote: > > On 07/09/2018 08:36 AM, Aldy Hernandez wrote: > >{ dg-do run } > >{ do-options "-O2 -fno-tree-strlen" } */ > > > > I don't think this is doing anything. > > > > If you look at the test run you can see that -fno-tree-strlen is ne

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-09 Thread Martin Sebor
On 07/09/2018 08:36 AM, Aldy Hernandez wrote: { dg-do run } { do-options "-O2 -fno-tree-strlen" } */ I don't think this is doing anything. If you look at the test run you can see that -fno-tree-strlen is never passed (I think you actually mean -fno-optimize-strlen for that matter).

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-09 Thread Martin Sebor
On 07/09/2018 01:51 PM, Jeff Law wrote: On 07/09/2018 08:36 AM, Aldy Hernandez wrote: { dg-do run } { do-options "-O2 -fno-tree-strlen" } */ I don't think this is doing anything. If you look at the test run you can see that -fno-tree-strlen is never passed (I think you actually mea

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-09 Thread Jeff Law
On 07/09/2018 08:36 AM, Aldy Hernandez wrote: >{ dg-do run } >{ do-options "-O2 -fno-tree-strlen" } */ > > I don't think this is doing anything. > > If you look at the test run you can see that -fno-tree-strlen is never > passed (I think you actually mean -fno-optimize-strlen for th

Re: [PATCH] add support for strnlen (PR 81384)

2018-07-09 Thread Aldy Hernandez
{ dg-do run } { do-options "-O2 -fno-tree-strlen" } */ I don't think this is doing anything. If you look at the test run you can see that -fno-tree-strlen is never passed (I think you actually mean -fno-optimize-strlen for that matter). Also, the builtins.exp harness runs your test f

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-19 Thread Jeff Law
On 06/19/2018 02:10 PM, Martin Sebor wrote: > On 06/19/2018 01:33 PM, David Edelsohn wrote: >> Martin, >> >> Does attr-nonstring-3.c assume a 64 bit environment? > > I don't think so.  The error below suggests a problem during > the expansion of the strncmp built-in.  The patch didn't > change tha

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-19 Thread Martin Sebor
On 06/19/2018 02:10 PM, Martin Sebor wrote: On 06/19/2018 01:33 PM, David Edelsohn wrote: Martin, Does attr-nonstring-3.c assume a 64 bit environment? I don't think so. The error below suggests a problem during the expansion of the strncmp built-in. The patch didn't change that. I see GCC

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-19 Thread Martin Sebor
On 06/19/2018 01:33 PM, David Edelsohn wrote: Martin, Does attr-nonstring-3.c assume a 64 bit environment? I don't think so. The error below suggests a problem during the expansion of the strncmp built-in. The patch didn't change that. I see GCC 8 ICE on the test as well so it must be a lat

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-19 Thread David Edelsohn
Martin, Does attr-nonstring-3.c assume a 64 bit environment? I'm seeing new errors on the rs6000 port FAIL: gcc.dg/attr-nonstring-3.c (internal compiler error) /nasfarm/edelsohn/src/src/gcc/testsuite/gcc.dg/attr-nonstring-3.c:73:1: error: could not split insn (insn 3244 3245 3246 (set (reg:SI 5

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-18 Thread Martin Sebor
On 06/12/2018 03:11 PM, Jeff Law wrote: On 06/05/2018 03:43 PM, Martin Sebor wrote: The attached patch adds basic support for handling strnlen as a built-in function. It touches the strlen pass where it folds constant results of the function, and builtins.c to add simple support for expanding s

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-12 Thread Jeff Law
On 06/05/2018 03:43 PM, Martin Sebor wrote: > The attached patch adds basic support for handling strnlen > as a built-in function.  It touches the strlen pass where > it folds constant results of the function, and builtins.c > to add simple support for expanding strnlen calls with known > results. 

PING [PATCH] add support for strnlen (PR 81384)

2018-06-12 Thread Martin Sebor
I'm looking for a review of the patch below (beyond using DEF_EXT_LIB_BUILTIN to declare the built-in rather than DEF_LIB_BUILTIN, as already pointed out by Jakub): https://gcc.gnu.org/ml/gcc-patches/2018-06/msg00267.html On 06/05/2018 03:43 PM, Martin Sebor wrote: The attached patch adds bas

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-06 Thread Jakub Jelinek
On Wed, Jun 06, 2018 at 09:14:11AM -0600, Martin Sebor wrote: > On 06/05/2018 04:19 PM, Jakub Jelinek wrote: > > On Tue, Jun 05, 2018 at 03:43:17PM -0600, Martin Sebor wrote: > > > --- a/gcc/builtins.def > > > +++ b/gcc/builtins.def > > > @@ -733,6 +733,7 @@ DEF_EXT_LIB_BUILTIN(BUILT_IN_STRNCAS

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-06 Thread Martin Sebor
On 06/05/2018 04:19 PM, Jakub Jelinek wrote: On Tue, Jun 05, 2018 at 03:43:17PM -0600, Martin Sebor wrote: --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -733,6 +733,7 @@ DEF_EXT_LIB_BUILTIN(BUILT_IN_STRNCASECMP, "strncasecmp", BT_FN_INT_CONST_STR DEF_LIB_BUILTIN(BUILT_IN_STRNCAT

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-06 Thread Martin Sebor
On 06/05/2018 06:39 PM, Eric Gallager wrote: On 6/5/18, Martin Sebor wrote: The attached patch adds basic support for handling strnlen as a built-in function. It touches the strlen pass where it folds constant results of the function, and builtins.c to add simple support for expanding strnlen

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-05 Thread Eric Gallager
On 6/5/18, Martin Sebor wrote: > The attached patch adds basic support for handling strnlen > as a built-in function. It touches the strlen pass where > it folds constant results of the function, and builtins.c > to add simple support for expanding strnlen calls with known > results. It also cha

Re: [PATCH] add support for strnlen (PR 81384)

2018-06-05 Thread Jakub Jelinek
On Tue, Jun 05, 2018 at 03:43:17PM -0600, Martin Sebor wrote: > --- a/gcc/builtins.def > +++ b/gcc/builtins.def > @@ -733,6 +733,7 @@ DEF_EXT_LIB_BUILTIN(BUILT_IN_STRNCASECMP, > "strncasecmp", BT_FN_INT_CONST_STR > DEF_LIB_BUILTIN(BUILT_IN_STRNCAT, "strncat", > BT_FN_STRING_STRING_CO

[PATCH] add support for strnlen (PR 81384)

2018-06-05 Thread Martin Sebor
The attached patch adds basic support for handling strnlen as a built-in function. It touches the strlen pass where it folds constant results of the function, and builtins.c to add simple support for expanding strnlen calls with known results. It also changes calls.c to detect excessive bounds t