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

--- Comment #5 from Zack Weinberg <zackw at panix dot com> ---
It might be good to include stores to nonzero offsets in the test case, and
stores to bytes that used to be internal NULs, something like

    int main(void)
    {
      char s[] = "abc\0def";
      s[1] = (char) strlen(s);
      if (strlen(s) != 3) abort();
      s[2] = (char) strlen(s);
      if (strlen(s) != 3) abort();
      s[3] = (char) strlen(s);
      if (strlen(s) != 7) abort();
      return 0;
    }

I dunno how much of this is worth trying to optimize, but I'll also mention
that if the values at a certain offset before and after a store are not known
for certain but are both known to be nonzero, that store doesn't have to
invalidate a cached string length.

Reply via email to