This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/57230] [4.7/4.8/4.9 Regression] tree-ssa-strlen incorrectly optimizes a strlen to 0


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.


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