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/77899] incorrect VR_RANGE for a signed char function argument


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).

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