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

            Bug ID: 127905
           Summary: Another wrong code with BitInt
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Apologies for failing to come up with a better Summary.
This testcase aborts on aarch64 at -O2 and passes at -O0

#if __BITINT_MAXWIDTH__ >= 135
typedef unsigned _BitInt(135) M;

[[gnu::noipa]] M
f (M mb, int c, unsigned n)
{
  M x = c ? mb : 7;
  M y = mb;
  for (unsigned i = 0; i < n; i++)
    y = x + i;
  return y;
}

[[gnu::noipa]] M
g (M mb, M ma, int c, unsigned n)
{
  M x = c ? mb : 7;
  M y = mb;
  for (unsigned i = 0; i < n; i++)
    y = c ? x + 7 : ma;
  return y;
}
#endif

int
main ()
{
#if __BITINT_MAXWIDTH__ >= 135
  if (f (5, 1, 3) != 7 || g (5, 9, 1, 3) != 12)
    __builtin_abort ();
#endif
}

Reply via email to