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/58732] New: wrong code at -O3 on x86_64-linux-gnu


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

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

The attached testcase is miscompiled by gcc 4.8.1 on x86_64-linux-gnu at -O3 in
both 32-bit and 64-bit modes. 

It does not seem to affect the current gcc trunk, 4.6.x, and 4.7.x.

$ gcc-4.8 -v  
Using built-in specs.
COLLECT_GCC=gcc-4.8
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.1/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-checking
--with-gmp=/usr/local/gcc-4.8 --with-mpfr=/usr/local/gcc-4.8
--with-mpc=/usr/local/gcc-4.8 --with-cloog=/usr/local/gcc-4.8
--prefix=/usr/local/gcc-4.8
Thread model: posix
gcc version 4.8.1 (GCC) 
$ 
$ gcc-4.8 -O2 small.c; a.out
$
$ gcc-4.8 -O3 small.c; a.out
Aborted (core dumped)
$ 
$ gcc-trunk -O3 small.c; a.out
$ gcc-4.6 -O3 small.c; a.out 
$ gcc-4.7 -O3 small.c; a.out
$ 


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


static int a = -1, c, d;
int b[10];

int
main ()
{
  for (d = 1; d >= 0; d--)
    {
      b[8] = 0;
      for (c = 0; c; c++)
    ;
      b[d+8] = a;
    }

  if (b[8] != -1)
    __builtin_abort(); 

  return 0;
}


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