https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67253

            Bug ID: 67253
           Summary: ICE at -O3 on x86_64-linux-gnu (verify_gimple failed)
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk at
-O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It is a regression from 5.1.x. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20150815 (experimental) [trunk revision 226911] (GCC) 
$ 
$ gcc-trunk -O2 small.c; ./a.out
$ gcc-5.1 -O3 small.c; ./a.out
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘fn2.constprop’:
small.c:45:1: error: location references block not in block tree
 fn2 (char p1, int p2, int *p3)
 ^
&c
p3_277 = &c;
small.c:45:1: internal compiler error: verify_gimple failed
0xae9db2 verify_gimple_in_cfg(function*, bool)
        ../../gcc-trunk/gcc/tree-cfg.c:5101
0x9e35a7 execute_function_todo
        ../../gcc-trunk/gcc/passes.c:1948
0x9e3e53 execute_todo
        ../../gcc-trunk/gcc/passes.c:2005
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


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


int *a, b, c, **d = &a, e, f, **h, i, j, k, l, m, *n, o, **q, r, s;

void fn1 (int p) { }

void
fn3 ()
{
  for (; j; j++)
    for (; k; k++)
      l++;
  f++;
}

static int
fn4 (char p1, int *p2)
{
  for (; m < 1;)
    {
      fn1 (q == &p2);
      for (; o; o++)
        ;
      n = p2;
      return 0;
    }
  for (;;)
    {
      for (; s; s++)
        b = r;
      *d = 0;
    }
}

static int *fn2 (char, int, int *);

static int
fn5 ()
{
  int *g = &c;
  fn3 ();
  fn2 (0, 0, g);
  return e;
}

static int *
fn2 (char p1, int p2, int *p3)
{
  fn4 (0, p3);
  fn1 (&p3 == h);
  for (; i;)
    fn5 ();
  fn4 (0, p3);
  return *d;
}

int
main ()
{
  fn5 ();
  return 0;
}

Reply via email to