Testcase, compile at -O2:
void abort (void);
void exit (int);

int t = 100;

int main () {
  int a[] = { 0, 1, 2 };
  int *i = &a[sizeof(a)/sizeof(*a)];
  i --;
  while (i > a)
    i[0] = 1+t, i--;

  if (a[1] != 1+t)
    abort ();
  exit (0);
}


-- 
           Summary: [4.2/4.3 Regression] Wrong code with arrays
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code, alias
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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

Reply via email to