https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79529
Bug ID: 79529 Summary: [7 Regression] ICE in is_maybe_undefined (tree-ssa-loop-unswitch.c:162) Product: gcc Version: unknown Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: aldyh at gcc dot gnu.org, jamborm at gcc dot gnu.org Target Milestone: --- Building Firefox with -flto and -O3, one can get: /home/marxin/Programming/gecko-dev/intl/icu/source/i18n/dtptngen.cpp:1379:1: internal compiler error: Segmentation fault DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags, UDateTimePatternMatchOptions options) { ^ 0xcaea52 crash_signal ../../gcc/toplev.c:333 0x888c28 dominated_by_p(cdi_direction, basic_block_def const*, basic_block_def const*) ../../gcc/dominance.c:1117 0xe465f0 is_maybe_undefined ../../gcc/tree-ssa-loop-unswitch.c:162 0xe46863 tree_may_unswitch_on ../../gcc/tree-ssa-loop-unswitch.c:222 0xe46beb tree_unswitch_single_loop ../../gcc/tree-ssa-loop-unswitch.c:322 0xe46379 tree_ssa_unswitch_loops() ../../gcc/tree-ssa-loop-unswitch.c:102 0xe48337 execute ../../gcc/tree-ssa-loop-unswitch.c:935 Problem is that: if (dominated_by_p (CDI_DOMINATORS, loop->header, gimple_bb (def))) where def is a gimple nop, which has gimple_bb (def) == NULL. I guess following patch should fix that: diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 4ef3a6bf80a..5716c99e58c 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -141,6 +141,9 @@ is_maybe_undefined (const tree name, gimple *stmt, struct loop *loop) gimple *def = SSA_NAME_DEF_STMT (t); + if (gimple_nop_p (def)) + return true; + /* Check that all the PHI args are fully defined. */ if (gphi *phi = dyn_cast <gphi *> (def)) {