Re: Exploiting knowing sizes of string.

2015-06-04 Thread Ondřej Bílka
On Thu, Jun 04, 2015 at 09:06:40PM +0100, Richard Earnshaw wrote: > On 04/06/15 20:57, Jakub Jelinek wrote: > > On Thu, Jun 04, 2015 at 06:36:33PM +0200, Ondřej Bílka wrote: > >> On Thu, Jun 04, 2015 at 04:01:50PM +, Joseph Myers wrote: > >>> On Thu, 4 Jun 2015, Richard Earnshaw wrote: > >>> >

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Ondřej Bílka
On Thu, Jun 04, 2015 at 09:57:59PM +0200, Jakub Jelinek wrote: > On Thu, Jun 04, 2015 at 06:36:33PM +0200, Ondřej Bílka wrote: > > On Thu, Jun 04, 2015 at 04:01:50PM +, Joseph Myers wrote: > > > On Thu, 4 Jun 2015, Richard Earnshaw wrote: > > > > > > > > Change that into > > > > > > > > > > i

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Richard Earnshaw
On 04/06/15 20:57, Jakub Jelinek wrote: > On Thu, Jun 04, 2015 at 06:36:33PM +0200, Ondřej Bílka wrote: >> On Thu, Jun 04, 2015 at 04:01:50PM +, Joseph Myers wrote: >>> On Thu, 4 Jun 2015, Richard Earnshaw wrote: >>> > Change that into > > int foo(char *s) > { > int l = st

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Jakub Jelinek
On Thu, Jun 04, 2015 at 06:36:33PM +0200, Ondřej Bílka wrote: > On Thu, Jun 04, 2015 at 04:01:50PM +, Joseph Myers wrote: > > On Thu, 4 Jun 2015, Richard Earnshaw wrote: > > > > > > Change that into > > > > > > > > int foo(char *s) > > > > { > > > > int l = strlen (s); > > > > char *p = m

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Ondřej Bílka
On Thu, Jun 04, 2015 at 04:01:50PM +, Joseph Myers wrote: > On Thu, 4 Jun 2015, Richard Earnshaw wrote: > > > > Change that into > > > > > > int foo(char *s) > > > { > > > int l = strlen (s); > > > char *p = memchr (s, 'a', l); > > > return p+l; > > > } > > > > > > > Which is still me

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Andreas Schwab
Joseph Myers writes: > On Thu, 4 Jun 2015, Richard Earnshaw wrote: > >> > Change that into >> > >> > int foo(char *s) >> > { >> > int l = strlen (s); >> > char *p = memchr (s, 'a', l); >> > return p+l; >> > } >> > >> >> Which is still meaningless if 'a' does not appear in s => when the >

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Joseph Myers
On Thu, 4 Jun 2015, Richard Earnshaw wrote: > > Change that into > > > > int foo(char *s) > > { > > int l = strlen (s); > > char *p = memchr (s, 'a', l); > > return p+l; > > } > > > > Which is still meaningless if 'a' does not appear in s => when the > result is NULL + l. > > In fact, un

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Richard Earnshaw
On 04/06/15 15:23, Ondřej Bílka wrote: > On Thu, Jun 04, 2015 at 02:59:20PM +0200, Jakub Jelinek wrote: >> On Thu, Jun 04, 2015 at 02:53:31PM +0200, Ondřej Bílka wrote: >>> On Thu, Jun 04, 2015 at 02:33:19PM +0200, Jakub Jelinek wrote: On Thu, Jun 04, 2015 at 12:26:03PM +, Joseph Myers wro

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Ondřej Bílka
On Thu, Jun 04, 2015 at 02:59:20PM +0200, Jakub Jelinek wrote: > On Thu, Jun 04, 2015 at 02:53:31PM +0200, Ondřej Bílka wrote: > > On Thu, Jun 04, 2015 at 02:33:19PM +0200, Jakub Jelinek wrote: > > > On Thu, Jun 04, 2015 at 12:26:03PM +, Joseph Myers wrote: > > > > > Again is this worth a gcc p

Re: Exploiting knowing sizes of string.

2015-06-04 Thread Jakub Jelinek
On Thu, Jun 04, 2015 at 02:53:31PM +0200, Ondřej Bílka wrote: > On Thu, Jun 04, 2015 at 02:33:19PM +0200, Jakub Jelinek wrote: > > On Thu, Jun 04, 2015 at 12:26:03PM +, Joseph Myers wrote: > > > > Again is this worth a gcc pass? > > > > > > This isn't a matter of compiler passes; it's addition

Exploiting knowing sizes of string.

2015-06-04 Thread Ondřej Bílka
On Thu, Jun 04, 2015 at 02:33:19PM +0200, Jakub Jelinek wrote: > On Thu, Jun 04, 2015 at 12:26:03PM +, Joseph Myers wrote: > > > Again is this worth a gcc pass? > > > > This isn't a matter of compiler passes; it's additional checks in existing > > built-in function handling. Maybe that built