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

            Bug ID: 57876
           Summary: wrong code at -O3 on x86_64-linux-gnu in 32-bit mode
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk mis-compiles the following code on x86_64-linux at -O3 in
32-bit mode. This is a regression from 4.8.x. 

$ gcc-trunk -v   
gcc version 4.9.0 20130710 (experimental) [trunk revision 200864] (GCC) 
$
$ gcc-trunk -m32 -O3 small.c
$ a.out
0
$ gcc-trunk -m32 -O2 small.c
$ a.out
1
$ gcc-4.8 -m32 -O3 small.c
$ a.out
1
$ 


----------------------------------------------------


int printf (const char *, ...);

int a, b = 1, c, *d = &c, f, *g, h, j;
static int e;

int
main ()
{
  int i;
  for (i = 0; i < 2; i++)
    {
      long long k = b;
      int l;
      for (f = 0; f < 8; f++)
    {
      int *m = &e;
      j = *d;
      h = a * j - 1;
      *m = (h == 0) < k;
      g = &l;
    }
    }
  printf ("%d\n", e);
  return 0;
}

Reply via email to