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] Fix PR61762, reads from string constants


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).
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
> 
> Comments?
> 
> (yeah, those native_encode_expr improvement would be really nice,
> eventually for a slightly different interface, native_encode_expr_part)

Don't think you need a new function for that, just add an optional argument
to native_encode_expr, and propagate it to native_encode_string, which would
if the new bool arg is true not do:
  if (total_bytes > len)
    return 0;
but if total_bytes > len set total_bytes to len instead.
Or, isn't your code only handling STRING_CSTs and nothing else?
Then perhaps just export native_encode_string too and add the optional
argument to that.

	Jakub


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