https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246
--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This happens only on i686-mingw32 because this requires SJLJ exceptions. The
loop at stake is marked for removal during EH generation:
#0 mark_loop_for_removal (loop=0x7ffff6969ca8)
at /home/eric/svn/gcc/gcc/cfgloop.c:1933
#1 0x0000000000da97e2 in sjlj_emit_dispatch_table (
dispatch_label=0x7ffff6a4cec0, num_dispatch=6)
at /home/eric/svn/gcc/gcc/except.c:1394
#2 0x0000000000da9bbe in sjlj_build_landing_pads ()
at /home/eric/svn/gcc/gcc/except.c:1463
#3 0x0000000000da9d2d in finish_eh_generation ()
at /home/eric/svn/gcc/gcc/except.c:1497
#4 0x0000000000c7bd4c in (anonymous namespace)::pass_expand::execute (
this=0x39e6e60, fun=0x7ffff6924a80)
at /home/eric/svn/gcc/gcc/cfgexpand.c:6005
/* ??? For multiple dispatches we will end up with edges
from the loop tree root into this loop, making it a
multiple-entry loop. Discard all affected loops. */
if (num_dispatch > 1)
{
for (loop = bb->loop_father;
loop_outer (loop); loop = loop_outer (loop))
mark_loop_for_removal (loop);
}
but it is marked *twice* so loop->former_header is cleared the second time:
void
mark_loop_for_removal (loop_p loop)
{
loop->former_header = loop->header;
loop->header = NULL;
loop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
The ICE occurs immediately after:
#0 internal_error (gmsgid=0x2ea5d27 "in %s, at %s:%d")
at /home/eric/svn/gcc/gcc/diagnostic.c:1219
#1 0x00000000028a1772 in fancy_abort (
file=0x2a09ca0 "/home/eric/svn/gcc/gcc/loop-init.c", line=263,
function=0x2a0a100 <fix_loop_structure(bitmap_head*)::__FUNCTION__>
"fix_loop_structure") at /home/eric/svn/gcc/gcc/diagnostic.c:1275
#2 0x000000000102a1cd in fix_loop_structure (changed_bbs=0x0)
at /home/eric/svn/gcc/gcc/loop-init.c:263
#3 0x00000000026b48d9 in cleanup_cfg (mode=16)
at /home/eric/svn/gcc/gcc/cfgcleanup.c:3083