title: warning: iteration 5u invokes undefined behavior [-Waggressive-loop-optimizations]
body: <p>In the below code, I am not sure why I get the warning: iteration 5u invokes undefined behavior [-Waggressive-loop-optimizations] when I comment the printf(" "); statement in the for loop. How a printf statement contributes to this warning?.</p>
  
  <p>Secondly, this code go to endless loop. I know array index is outside the limit when entering while loop. But when i goes negative, while loop should have terminated. But not happening. If i-- is done before entering while loop, there is no issue. If index is out of bound, I should be just getting junk result right. But why endless!</p>
  
  <pre><code> int main (void)
  {
     int a[]={4,6,8,2,7};
     int i=0;
     int size = sizeof(a)/sizeof(a[0]);
  
    for(i=0;i&lt;size;i++)
     {
        // printf(" ");
     }
   // i--; // doing i-- works fine.
     while(i&gt;=0)
      {
        printf("%d\t",a[i]);
        i--;
      }
  
    return(0);
  
  }
  </code></pre>