From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77952 invoked by alias); 2 Mar 2015 07:07:11 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 77860 invoked by uid 55); 2 Mar 2015 07:07:07 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65263] [5 Regression] ICE (error: unrecognizable insn / in insn_min_length, at config/rs6000/rs6000.md) on powerpc64le-linux-gnu Date: Mon, 02 Mar 2015 07:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg00081.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65263 --- Comment #5 from Jan Hubicka --- Hi, the following (untested) patch should prevent redirection to happen. Index: ipa-icf.c =================================================================== --- ipa-icf.c (revision 221096) +++ ipa-icf.c (working copy) @@ -697,12 +697,22 @@ redirect_all_callers (cgraph_node *n, cg { int nredirected = 0; ipa_ref *ref; + cgraph_edge *e = n->callers; - while (n->callers) + while (e) { - cgraph_edge *e = n->callers; - e->redirect_callee (to); - nredirected++; + /* Redirecting thunks to interposable symbols or symbols in other sections + may not be supported by target output code. Play safe for now and + punt on redirection. */ + if (!e->caller->thunk.thunk_p) + { + struct cgraph_edge *nexte = e->next_callee; + e->redirect_callee (to); + e = nexte; + nredirected++; + } + else + e = e->next_callee; } for (unsigned i = 0; n->iterate_direct_aliases (i, ref);) { @@ -726,6 +736,17 @@ redirect_all_callers (cgraph_node *n, cg return nredirected; } +/* Return true if NODE has thunk. */ + +bool +has_thunk_p (cgraph_node *node, void *) +{ + for (cgraph_edge *e = node->callers; e; e = e->next_caller) + if (e->caller->thunk.thunk_p) + return true; + return false; +} + /* Merges instance with an ALIAS_ITEM, where alias, thunk or redirection can be applied. */ @@ -907,6 +928,7 @@ sem_function::merge (sem_item *alias_ite return false; } if (!create_wrapper + && !alias->call_for_symbol_and_aliases (has_thunk_p, NULL, true) && !alias->can_remove_if_no_direct_calls_p ()) { if (dump_file)