Compile this with -O2.

void
foo (int *table, unsigned int size)
{
  unsigned int i;

  for (i = 0; i < size; i++)
    {
      if (table[i])
        break;
    }

  table[i] = 0;
}

I get:

  pretmp.2_22 = 0 * 4;

-- 
           Summary: PRE creates "a_1 = 0 * 4" but does not fold it.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to