This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR61762, reads from string constants
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Jul 2014 17:28:43 +0200
- Subject: Re: [PATCH] Fix PR61762, reads from string constants
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1407101710260 dot 5753 at zhemvz dot fhfr dot qr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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