From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67512 invoked by alias); 24 Mar 2015 02:09:10 -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 67439 invoked by uid 55); 24 Mar 2015 02:09:07 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/65534] tailcall not optimized away Date: Tue, 24 Mar 2015 07:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: UNCONFIRMED 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/msg02465.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65534 --- Comment #1 from Jan Hubicka --- > #ifndef OPTIMIZE_MANUALLY > void setutent(void) { > ((void)0); > __setutent_unlocked(); > ((void)0); > } > #else > extern __typeof (__setutent_unlocked) setutent > __attribute__ ((alias ("__setutent_unlocked"))); > #endif I do not think GCC can safely optimize this, becuase in the first case &setutent != &__setutent_unlocked, wile in the optimized case the addresses are equal. This is something we looked into with Martin Liska but was late for GCC 5. We have -fmerge-all-constants, we may want to introduce something like -fmerge-all-functions declaring that this special case does not matter (curiously enough there is real world code that actually compares the addresses of otherwise equivalent functions, like in GCC PCH implementation). Second thing is to make ipa-ICF to discover wrappers and consider them semantically equivalent to their target. Something I also discussed with Martin. So hopefully early next stage1 this can be implemented. Honza