From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4710 invoked by alias); 20 Feb 2015 09:32:30 -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 4621 invoked by uid 48); 20 Feb 2015 09:32:27 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32 Date: Fri, 20 Feb 2015 09:32: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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mliska at suse dot cz X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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-02/txt/msg02228.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63892 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- So, during ICF we don't create alias because sem_item::target_supports_symbol_aliases_p () tells us not to. But I really don't see a reason why we couldn't try to redirect_callers in this case, both original and alias are local functions without address taken. There is another case that worries me - if the above mentioned function returns false, we set create_thunk even for stdarg_p functions. So, I think we should do something like: --- gcc/ipa-icf.c.jj 2015-02-19 12:52:33.000000000 +0100 +++ gcc/ipa-icf.c 2015-02-20 10:06:04.532637240 +0100 @@ -651,7 +651,9 @@ sem_function::merge (sem_item *alias_ite section (or we risk link failures when section is discarded). */ if ((original_address_matters && alias_address_matters) - || original_discardable) + || original_discardable + || DECL_COMDAT_GROUP (alias->decl) + || !sem_item::target_supports_symbol_aliases_p ()) { create_thunk = !stdarg_p (TREE_TYPE (alias->decl)); create_alias = false; @@ -659,6 +661,7 @@ sem_function::merge (sem_item *alias_ite the extra thunk wrapper for direct calls. */ redirect_callers = (!original_discardable + && !DECL_COMDAT_GROUP (alias->decl) && alias->get_availability () > AVAIL_INTERPOSABLE && original->get_availability () > AVAIL_INTERPOSABLE && !alias->instrumented_version); @@ -670,13 +673,6 @@ sem_function::merge (sem_item *alias_ite redirect_callers = false; } - if (create_alias && (DECL_COMDAT_GROUP (alias->decl) - || !sem_item::target_supports_symbol_aliases_p ())) - { - create_alias = false; - create_thunk = true; - } - /* We want thunk to always jump to the local function body unless the body is comdat and may be optimized out. */ if ((create_thunk || redirect_callers) Unfortunately this ICEs on the testcase in question, when we reach: 725 /* The alias function is removed if symbol address 726 does not matter. */ 727 if (!alias_address_matters) 728 alias->remove (); because in 1645 void 1646 sem_item_optimizer::remove_symtab_node (symtab_node *node) 1647 { 1648 gcc_assert (!m_classes.elements()); 1649 1650 m_removed_items_set.add (node); 1651 } called during the alias->remove () m_classes.elements() is 3. I'm not familiar with that code, Martin/Honza, can you please have a look? And, another thing, not analyzed fully, is that when we create a thunk to the local calling convention function and the thunk isn't visible either, the question is why it doesn't use the same calling convention (i.e. local again). Last thing, I believe we should change the testcase anyway, either use -fno-ipa-icf or add say some volatile int v; v++; into one of the functions, so that sibcall-3.c tests what it originally meant to test. With ICF it can be turned into a tail recursion test, while clearly originally it was meant to be a tail call test. We can certainly copy the current testcase into a new one...