The following should not abort at any optimization level but does at -O2:
void abort (void);
void g(int);
void f(int l)
{
  unsigned i;
  for (i = 0; i < l; i++)
    {
      int y = i;
      int z = y*-32;
      g(z);
    }
}

void g(int i)
{
  static int x = 0;
  if (i == 0)
    x ++;
  if (x > 1)
    abort ();
}

int main(void)
{
  f(3);
  return 0;
}


This is reduced from the message at:
<http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00458.html>.

-- 
           Summary: [4.1 Regression] VRP miscompiles multiply
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code, build
          Severity: critical
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to