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

            Bug ID: 106408
           Summary: PRE with infinite loops
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

int array[10000];
volatile int val;
int test(short *b,int s)
{
        for (int i = 0; i<10000;i++)
          {
            for (int j = 0; j < 10; j+=s)
                val++;
            array[i]+=*b;
          }
}

shows we PRE the *b load from both GIMPLE and RTL PRE across the possibly
infinite loop (with s == 0).  The function makes progress by means of
the volatile access which is considered I/O.

Reply via email to