https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625

--- Comment #9 from Renlin Li <renlin at gcc dot gnu.org> ---
(In reply to nsz from comment #8)
> (In reply to Jakub Jelinek from comment #6)
> > (In reply to Marc Glisse from comment #1)
> > > Or we could do like clang and improve alias analysis. We should know that
> > > array doesn't escape and thus that hallo() cannot write to it.
> > 
> > The strlen pass uses the alias oracle, so the question is why it thinks the
> > call might affect the array.
> 
> the optimization fails with
> 
>  const char array[] = "abc";
> 
> too (which is why i thought it was about pure strlen depending on global
> state
> other than the argument.. static const array works though).

char *array = "abc";

works, however, this generates string literals in read-only section.

Reply via email to