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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
fast_dce gathers postorder and friends computing all_blocks before it
eventually does

      if (global_changed)
        {
          /* Turn off the RUN_DCE flag to prevent recursive calls to
             dce.  */
          int old_flag = df_clear_flags (DF_LR_RUN_DCE);

          /* So something was deleted that requires a redo.  Do it on
             the cheap.  */
          delete_unmarked_insns ();
^^^

which alters the CFG, removing edges/blocks here:

#0  remove_edge (e=<edge 0x7ffff69d82d0 (3 -> 5)>)
    at /space/rguenther/src/svn/gcc-8-branch/gcc/cfghooks.c:423
#1  0x0000000000a16458 in purge_dead_edges (
    bb=<basic_block 0x7ffff68852d8 (3)>)
    at /space/rguenther/src/svn/gcc-8-branch/gcc/cfgrtl.c:3080
#2  0x0000000000a0fcb9 in delete_insn_and_edges (insn=0x7ffff69d51f8)
    at /space/rguenther/src/svn/gcc-8-branch/gcc/cfgrtl.c:233
#3  0x0000000001b8f314 in delete_unmarked_insns ()
    at /space/rguenther/src/svn/gcc-8-branch/gcc/dce.c:636

where we'd eventually alos purge unreachable blocks.

but then we simply continue

          bitmap_clear (marked);
          bitmap_clear (processed);
          bitmap_clear (redo_out);

          /* We do not need to rescan any instructions.  We only need
             to redo the dataflow equations for the blocks that had a
             change at the top of the block.  Then we need to redo the
             iteration.  */
          if (word_level)
            df_analyze_problem (df_word_lr, all_blocks, postorder, n_blocks);
          else
            df_analyze_problem (df_lr, all_blocks, postorder, n_blocks);

and here things blow up because DF is still set up on the old CFG or
we are at least passing in old CFG state (all_blocks, postorder, n_blocks)
here.

Reply via email to