From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3DEAA3851C0F; Sat, 6 Jun 2020 14:40:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DEAA3851C0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591454445; bh=og3o9bljzNfcSuwDDHTYuBXfkeSDvnwhOVv5oF1CUNg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YLUlRYuNd/Ukl8vt1JDP4Ki9D+6ewTFnGh6TSjZnLZNtbqBXd4nAeqRvypC7wlso/ hY4sU42Em5cFr6SD0/r1P5MKzIVDvl0qnUHLTLE900UIDslTarW7o59mtGFmtmFJ8e ID+4PbufMeAeOWEyFIQ3EB6QMFjL9F0iGbjEgBOo= From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/95558] Invalid IPA optimizations based on weak definition Date: Sat, 06 Jun 2020 14:40:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: unknown X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: bugdal at aerifal dot cx X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jun 2020 14:40:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95558 --- Comment #3 from Rich Felker --- In addition to a fix, this is going to need a workaround as well. Do you ha= ve ideas for a clean one? A dummy asm in the dummy function to kill pureness is certainly a big hammer that would work, but it precludes LTO optimization if the weak definition doesn't actually get replaced, so I don't like that. One idea I think would work, but not sure: make an external __weak_dummy_ta= il function that all the weak dummies tail call to. This should only take a few bytes more than just returning, and precludes pureness analysis in the TU i= t's in, while still allowing DCE at LTO time when the definition of __weak_dummy_tail becomes available. Is my reasoning correct here?=