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

--- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> ---
I don't see what "signed" has to do with it.

void f (unsigned char i)
{
  char d [1260];

  const char *p = &d[130];

  p += i;

  if (p < d + 2 || d + 757 < p)
    __builtin_abort ();
}

We don't optimize this either. We would need either to record a range of
[d+130, d+385] for p_3, or to match the pattern &d[CST1] + X cmp &d[CST2] and
check if the range of X lets us conclude (actually, maybe we could generally
turn this into X + CST1 cmp CST2, which would then be handled by existing
code).

Reply via email to