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

            Bug ID: 58957
           Summary: compilation hangs at -O3 on x86_64-linux-gnu (both
                    32-bit and 64-bit modes)
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes gcc 4.8.2 (as well as gcc 4.8.0 and gcc 4.8.1) to
hang at -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It doesn't affect gcc trunk, 4.7.x, and 4.6.x. 


$ gcc-trunk -O3 small.c  
$ gcc-4.6 -O3 small.c
$ gcc-4.7 -O3 small.c
$ 
$ gcc-4.8 -O3 small.c
^C
$
$ gcc-4.8 -v
Using built-in specs.
COLLECT_GCC=gcc-4.8
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8.2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.2/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --enable-checking=release
--with-gmp=/home/su/software/local/gcc-4.8.2
--with-mpfr=/home/su/software/local/gcc-4.8.2
--with-mpc=/home/su/software/local/gcc-4.8.2
--with-cloog=/home/su/software/local/gcc-4.8.2
--prefix=/home/su/software/local/gcc-4.8.2
Thread model: posix
gcc version 4.8.2 (GCC) 
$ 


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


void __assert_fail () __attribute__ ((__noreturn__));

int a[10], b, c, d, *e, **f = &e, g, i, *j; 
unsigned int h;

int *
foo ()
{
  for (c = 0; c < 10; c++)
    for (i = 1; i >= 0; i--)
      for (d = 0; d < 10; d++)
    {
      j = &a[d];
      j >= &a[0] && j <= &a[9] ? (void) 0 : __assert_fail ();
    }
  return &b;
}

int
main ()
{
  for (g = 3; g < 10; g++)
    for (; h < 10; h++)
      *f = foo ();
  return 0;
}

Reply via email to