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

            Bug ID: 98727
           Summary: [11 Regression] Miscompiled signed overflow check
                    since r11-6580
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

__attribute__((noipa)) long int
foo (long int x, long int y)
{
  long int z = (unsigned long) x * y;
  if (x != z / y)
    return -1;
  return z;
}

int
main ()
{
  if (foo (4, 24) != 96
      || foo (124, 126) != 124L * 126
      || foo (__LONG_MAX__ / 16, 17) != -1)
    __builtin_abort ();
  return 0;
}

is miscompiled at -O2 since r11-6580-g9febe9e4be7812519258ea3ed4f38bbc1a61624b

Reply via email to