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

--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, I've also come to realize that the surprising signed char range is a red
herring since the abort in the following test case is also not optimized away.

void f (_Bool i)
{
  char d [3];

  const char *p = &d[1];

  p += i;

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

But I do stand by my point about the range representation of signed char in
POINTER_PLUS_EXPR.  It confused me enough to suspect that it may have been the
reason why the if statement wasn't optimized away (possibly also because in my
patch for bug 77608 wasn't prepared to handle such ranges, or handle them
correctly; the handling I added seemed like a workaround to me, hence this
bug).

Reply via email to