On Mon, Jun 14, 2021 at 09:47:18AM +0200, Richard Biener wrote:
> strlen opt uses ao_ref_init_from_ptr_and_size to prepare alias
> queries to invalidate its knowledge about strings.  It constrains
> the size using the number of known-nonzero chars and adds one
> for a terminating nul - without knowing whether such nul exists
> or even fits the object.  The latter is now a problem since the
> oracle disambiguates an access of size two (as built so) against
> a store to a plain char variable (where a terminating nul does not
> fit).  The fix is to instead increment max_size but leave size to
> the number of chars we know are accessed.
> 
> Bootstrap and regtest running on x86_64-unknown-linux-gnu.
> 
> Richard.
> 
> 2021-06-14  Richard Biener  <rguent...@suse.de>
> 
>       PR tree-optimization/101031
>       * tree-ssa-strlen.c (maybe_invalidate): Increment max_size
>       instead of size when accounting for a possibly string
>       terminating nul.
> 
>       * gcc.dg/torture/pr101031.c: New testcase.

Ok, thanks.

        Jakub

Reply via email to