This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/57877] New: wrong code at -Os on x86_64-linux-gnu in 32-bit mode


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

            Bug ID: 57877
           Summary: wrong code at -Os 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 -Os 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 -Os small.c
$ a.out
0
$ gcc-trunk -m32 -O3 small.c
$ a.out
1
$ gcc-4.8 -m32 -Os small.c
$ a.out
1
$ 


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


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

int a, b, *c = &b, e, f = 6, g, h;
short d;

static unsigned char
foo (unsigned long long p1, int *p2)
{
  for (; g <= 0; g++)
    {
      short *i = &d;
      int *j = &e;
      h = *c;
      *i = h;
      *j = (*i == *p2) < p1;
    }
  return 0;
}

int
main ()
{
  foo (f, &a);
  printf ("%d\n", e);
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]