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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We have just one strlen pass instance, and even if we optimize the first strlen
there, having strlen pass duplicate constant propagation functionality just to
handle this weird testcase (storing strlen sizes inside of characters is
nothing common) doesn't make sense.
We could handle
int
main ()
{
  char p[] = "foobar";
  p[1] = 'O';
  p[6] = 'R';
  int len = strlen (p);
  foo (len);
}

perhaps, but it could work only for constant recorded string lengths, so that
the offset can be checked against that length, and would require known non-zero
value to be stored (or, once VRP info is preserved, perhaps just use the VRP
info to prove non-zero).

Reply via email to