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

            Bug ID: 126456
           Summary: [14/15/16/17 Regression] Wrong code with minmax
                    folding
           Product: gcc
           Version: 16.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
  Target Milestone: ---

__attribute__((noipa)) int
min_le (int a, int c)
{
  return (a <= 6) ? (a < c ? a : c) : (5 < c ? 5 : c);
}

__attribute__((noipa)) int
max_ge (int a, int c)
{
  return (a >= 4) ? (a > c ? a : c) : (5 > c ? 5 : c);
}

int
main (void)
{
  if (min_le (6, 10) != 6)
    __builtin_abort ();
  if (max_ge (4, 0) != 4)
    __builtin_abort ();
  return 0;
}

This code aborts on aarch64 at all -O levels since GCC 14, but runs fine on GCC
13

Reply via email to