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

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Wed Jan 16 20:13:23 2019
New Revision: 267984

URL: https://gcc.gnu.org/viewcvs?rev=267984&root=gcc&view=rev
Log:
Fix ICE due to "combine" creating unreachable EH blocks (PR target/88861)

PR target/88861 reports an ICE in "ce2" due to an unreachable
basic block.

The block becomes unreachable in "combine" when delete_noop_moves
deletes an insn with a REG_EH_REGION, deleting the EH edge, the
only edge leading to the basic block.

Normally, rest_of_handle_combine would call cleanup_cfg, deleting
unreachable blocks, if combine_instructions returns true, and
combine_instructions does return true for some cases of edge-removal,
but it doesn't for this case, leading to the ICE.

This patch updates delete_noop_moves so that it returns true if
it deletes any edges, and passes that through to combine_instructions,
so that it too will return true if any edges were deleted, ensuring that
cleanup_cfg will be called by rest_of_handle_combine for this case,
deleting the now-unreachable block, and fixing the ICE.

gcc/ChangeLog:
        PR target/88861
        * combine.c (delete_noop_moves): Convert to "bool" return,
        returning true if any edges are eliminated.
        (combine_instructions): Also return true if delete_noop_moves
        returns true.

gcc/testsuite/ChangeLog:
        PR target/88861
        * g++.dg/torture/pr88861.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/torture/pr88861.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog

Reply via email to