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

            Bug ID: 57860
           Summary: wrong code for bitwise ops with long long literal on
                    x86_64-linux (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 -O2
and -O3 in 32-bit mode. This is a regression from 4.8.x. 

$ gcc-trunk -v
gcc version 4.9.0 20130708 (experimental) [trunk revision 200751] (GCC) 
$ gcc-trunk -m32 -O2 reduced.c
$ a.out
0
$ gcc-trunk -m32 -O3 reduced.c
$ a.out
0
$ gcc-trunk -m32 -O0 reduced.c
$ a.out
1
$ gcc-4.8 -m32 -O2 reduced.c
$ a.out
1
$ 


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


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

int a, *b = &a, c, d, e, *f = &e, g, *h = &d, k[1] = {1};

int
foo (int p)
{
  for (;; g++)
    {
      for (; c; c--);
      *f = *h = p > ((0x1FFFFFFFFLL ^ a) & *b);
      if (k[g])
    return 0;
    }
}

int
main ()
{
  foo (1);
  printf ("%d\n", d);
  return 0;
}

Reply via email to