http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57230

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I've thought more like:
int
main ()
{
  char p[] = "foobar";
  int len = strlen (p);
  p[1] = 'O';
  p[6] = 'R';
  int len2 = strlen (p);
  foo (len, len2);
}
thus, there shouldn't be a need for the second strlen call, but currently we
generate it.

I'm looking into it today, but wasn't very successful so far, when we're
walking over handle_char_store statements, I don't know how to get the cached
string length of p.  I wanted to use 
idx = get_addr_stridx (lhs);
but that didn't work out.

Reply via email to