[Bug c++/86422] G++ ICE(segmentation fault) when compiling a huge static array of sufficiently complex structs

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 9 10:04:00 GMT 2018


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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So with a debug build I can see

(gdb) run
Starting program: /home/abuild/rguenther/gcc8-g/gcc/cc1plus -quiet
/tmp/CodePoint.ii

Program received signal SIGSEGV, Segmentation fault.
0x0000000001576cf6 in verify_vssa (bb=<basic_block 0x7fff7bc081a0 (1591494)>, 
    current_vdef=<ssa_name 0x7fff2894d3a8>, visited=0x1389be00)
    at /space/rguenther/src/svn/gcc-8-branch/gcc/tree-ssa.c:632
632       if (bitmap_bit_p (visited, bb->index))
(gdb) p bb
$1 = <basic_block 0x7fff7bc081a0 (1591494)>

(ick btw, that are many basic blocks)

and the SEGFAULT is a stack overflow due to recursion in verify_vssa which
does

  /* Verify destination PHI uses and recurse.  */
  edge_iterator ei;
  edge e;
  FOR_EACH_EDGE (e, ei, bb->succs)
    {
      gphi *phi = get_virtual_phi (e->dest);
      if (phi
          && PHI_ARG_DEF_FROM_EDGE (phi, e) != current_vdef)
        {
          error ("PHI node with wrong VUSE on edge from BB %d",
                 e->src->index);
          print_gimple_stmt (stderr, phi, 0, TDF_VOPS);
          fprintf (stderr, "expected ");
          print_generic_expr (stderr, current_vdef);
          fprintf (stderr, "\n");
          err = true;
        }

      /* Recurse.  */
      err |= verify_vssa (e->dest, current_vdef, visited);

which is of course stupid.  I'll fix that.

Re-running with -fno-checking now to side-step the above issue (as said,
this is a --enable-checking build).

I do know we have some algorithms that recurse to dominator sons and
very likely the CFG structure will result in big recursion depth there
as well.

So maybe a workaround for you is to do ulimit -s unlimited?


More information about the Gcc-bugs mailing list