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

            Bug ID: 58697
           Summary: wrong code (segfaults) at -O3
           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

GCC 4.8.1 miscompiles the following code on x86_64-linux at -O3 in 64-bit mode,
resulting in a segfault. 

It doesn't seem to affect the current trunk and 4.7.x. 

It is related to 58653. 


$ 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 -O3 small.c; a.out
Segmentation fault (core dumped)
$
$ gcc-trunk -O3 small.c; a.out
$
$ gcc-4.7 -O3 small.c; a.out
$ 


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

int b, f, d[5][2];
unsigned int c;

int
main ()
{
  for (c = 0; c < 2; c++)
    if (d[b + 3][c] & d[b + 4][c])
      if (f)
    break;
  return 0;
}

Reply via email to