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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
No need to bisect that, I've verified it is that commit.
And am planning to use
[[gnu::noipa]] unsigned char
foo (long long val)
{
  unsigned char result = 0;
  switch (val)
    {
    case 0: result = 1; break;
    case 1: result = 2; break;
    case 2: result = 3; break;
    default: break;
    }
  return result;
}

int
main ()
{
  if (foo (-1) != 0)
    __builtin_abort ();
  if (foo (0) != 1)
    __builtin_abort ();
  if (foo (1) != 2)
    __builtin_abort ();
  if (foo (2) != 3)
    __builtin_abort ();
  if (foo (3) != 0)
    __builtin_abort ();
  if (foo (-__LONG_LONG_MAX__ - 1) != 0)
    __builtin_abort ();
  if (foo (-__LONG_LONG_MAX__) != 0)
    __builtin_abort ();
  if (foo (-__LONG_LONG_MAX__ + 1) != 0)
    __builtin_abort ();
}

The commit is right in that the indexes of the CONSTRUCTORs should be at most
sizetype, but the comparison if it is out of bounds should be in utype rather
than sizetype.

Reply via email to