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

            Bug ID: 101291
           Summary: turns infinite loop into finite
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guojiufu at gcc dot gnu.org
  Target Milestone: ---

For the below code, it should run infinite, but it terminates quickly.

#include <limits.h>
__attribute__ ((noinline))
unsigned foo(unsigned val, unsigned start)
{
  unsigned cnt = 0;
  for (unsigned i = start; i <= val; i+=16)
    cnt++;
  return cnt;
}

int main()
{
  return foo (UINT_MAX-7, 8);
}

Reply via email to