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

            Bug ID: 66413
           Summary: ICE at -Os and above with -g enabled on
                    x86_64-linux-gnu
           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
-Os and above with -g enabled on x86_64-linux-gnu in both 32-bit and 64-bit
modes.

This is a regression from 5.1.x. 

The test case is still quite complex, but I couldn't seem to reduce it further. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-unknown-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 20150603 (experimental) [trunk revision 224056] (GCC) 
$ 
$ gcc-trunk -Os small.c; ./a.out
$ gcc-trunk -O1 -g small.c; ./a.out
$ gcc-5.1.0 -Os -g small.c; ./a.out
$ 
$ gcc-trunk -Os -g small.c
small.c: In function ‘fn4.constprop’:
small.c:39:1: error: location references block not in block tree
 fn4 (int *p1)
 ^
&d
# DEBUG p1 => &d
small.c:39:1: internal compiler error: verify_gimple failed
0xb456c7 verify_gimple_in_cfg(function*, bool)
        ../../gcc-trunk/gcc/tree-cfg.c:5137
0xa3f3b7 execute_function_todo
        ../../gcc-trunk/gcc/passes.c:1946
0xa3fc23 execute_todo
        ../../gcc-trunk/gcc/passes.c:2003
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, i, j, q, *e, *h, *k, *r, **p = &e;
const int *f, **n = &f;
static int g;

void
fn1 (int p1)
{
  c = p1;
}

static int *
fn2 (int *p1, const int *p2)
{
  if (g)
    n = &p2;
  *n = p2;
  int o[245];
  fn1 (o != p2);
  return p1;
}

static int *
fn3 ()
{
  int s[54], *t = &s[0], u = 0, v = 1;
  h = &v;
  q = 1;
  for (; q; q++)
    {
      int *w[] = { &u };
      for (; v;)
        return *p;
    }
  *r = *t + b >= 0;
  return *p;
}

static int
fn4 (int *p1)
{
  int *l[2], **m[7];
  for (; i < 1; i++)
    for (; j < 1; j++)
      m[i * 70] = &l[0];
  k = fn3 ();
  fn2 (0, p1);
  if ((m[0] == 0) & a)
    for (;;)
      ;
  return 0;
}

int
main ()
{
  fn4 (&d);
  return 0;
}

Reply via email to