------- Comment #10 from bonzini at gnu dot org  2007-02-23 14:30 -------
No, i (which is in %edx) *is* being incremented.  It's the strength-reduced
derived induction variable that is constructed in a wrong way.  The optimized
code looks like:

void bug (struct s *p)
{
  int i;
  struct s *pp = p;
  for (i=0; i < 2; i++)
    {
      goto loop_cond;

     loop:
      /* ??? I think gcc assumes that pp (%eax) is an induction variable of
         the inner loop... */
      pp[-1].first = 0;
     loop_cond:
      if (!pp[0].first)
        goto break_out_of_inner_loop;
      if (pp[0].done)
        goto loop;

     break_out_of_inner_loop;
      pp++; /* actually adds sizeof (struct s) in the asm code */
      i++;
    }
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30931

Reply via email to