https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88788
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P1 Status|UNCONFIRMED |NEW Known to work| |8.2.0 Keywords| |needs-reduction Last reconfirmed| |2019-01-10 Ever confirmed|0 |1 Target Milestone|--- |9.0 Known to fail| |9.0 --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Patch that can trigger ICE: diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index ba0c7c2d83e..3481719aa9d 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -878,8 +878,10 @@ check_retval_uses (tree retval, gimple *stmt) } static bool -malloc_candidate_p_1 (function *fun, tree retval, gimple *ret_stmt, bool ipa) +malloc_candidate_p_1 (function *fun, tree retval, gimple *ret_stmt, bool ipa, + int depth) { + gcc_assert (depth < 40); cgraph_node *node = cgraph_node::get_create (fun->decl); if (!check_retval_uses (retval, ret_stmt)) @@ -925,7 +927,7 @@ malloc_candidate_p_1 (function *fun, tree retval, gimple *ret_stmt, bool ipa) gimple *arg_def = SSA_NAME_DEF_STMT (arg); if (is_a<gphi *> (arg_def)) { - if (!malloc_candidate_p_1 (fun, arg, phi, ipa)) + if (!malloc_candidate_p_1 (fun, arg, phi, ipa, depth + 1)) DUMP_AND_RETURN ("nested phi fail") continue; } @@ -987,7 +989,7 @@ malloc_candidate_p (function *fun, bool ipa) || TREE_CODE (TREE_TYPE (retval)) != POINTER_TYPE) DUMP_AND_RETURN("Return value is not SSA_NAME or not a pointer type.") - if (!malloc_candidate_p_1 (fun, retval, ret_stmt, ipa)) + if (!malloc_candidate_p_1 (fun, retval, ret_stmt, ipa, 0)) return false; } I'll try to reduce that.