Re: [PATCH] Fix PR61762, reads from string constants

2014-07-11 Thread Richard Biener
On Fri, 11 Jul 2014, Jakub Jelinek wrote: > On Fri, Jul 11, 2014 at 11:13:12AM +0200, Richard Biener wrote: > > + if (offset >= off) > > + ptr[offset - off] = value; > > For original off != 0, you aren't checking whether offset - off < len > though (various places), you don't want to w

Re: [PATCH] Fix PR61762, reads from string constants

2014-07-11 Thread Jakub Jelinek
On Fri, Jul 11, 2014 at 11:13:12AM +0200, Richard Biener wrote: > + if (offset >= off) > + ptr[offset - off] = value; For original off != 0, you aren't checking whether offset - off < len though (various places), you don't want to write beyond end of buffer. > - return total_bytes; >

Re: [PATCH] Fix PR61762, reads from string constants

2014-07-11 Thread Richard Biener
On Fri, 11 Jul 2014, Richard Biener wrote: > On Fri, 11 Jul 2014, Jakub Jelinek wrote: > > > On Fri, Jul 11, 2014 at 10:00:01AM +0200, Richard Biener wrote: > > > I started with adding an optional arg to native_encode_expr but then > > > figured that all the current workers return failure if the

Re: [PATCH] Fix PR61762, reads from string constants

2014-07-11 Thread Richard Biener
On Fri, 11 Jul 2014, Jakub Jelinek wrote: > On Fri, Jul 11, 2014 at 10:00:01AM +0200, Richard Biener wrote: > > I started with adding an optional arg to native_encode_expr but then > > figured that all the current workers return failure if the entire > > expr doesn't fit within 'len'. But what I

Re: [PATCH] Fix PR61762, reads from string constants

2014-07-11 Thread Jakub Jelinek
On Fri, Jul 11, 2014 at 10:00:01AM +0200, Richard Biener wrote: > I started with adding an optional arg to native_encode_expr but then > figured that all the current workers return failure if the entire > expr doesn't fit within 'len'. But what I want is a native_encode_expr That is because the f

Re: [PATCH] Fix PR61762, reads from string constants

2014-07-11 Thread Richard Biener
On Thu, 10 Jul 2014, Jakub Jelinek wrote: > On Thu, Jul 10, 2014 at 05:12:53PM +0200, Richard Biener wrote: > > The following makes sure we fold the reads from string constants > > created from folding memcpy (&foo, &string_cst[0], ...) to > > eventually create similar code as if that memcpy foldi

Re: [PATCH] Fix PR61762, reads from string constants

2014-07-10 Thread Jakub Jelinek
On Thu, Jul 10, 2014 at 05:12:53PM +0200, Richard Biener wrote: > The following makes sure we fold the reads from string constants > created from folding memcpy (&foo, &string_cst[0], ...) to > eventually create similar code as if that memcpy folding wasn't > done (move-by-pieces). > > Bootstrappe