From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 17B19385BF81; Sat, 6 Jun 2020 03:45:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B19385BF81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591415148; bh=Aqx88n2zl7iYtMN54us9DkY+3QnzJorr+tqM4wWsKoE=; h=From:To:Subject:Date:From; b=C3zcLG9M5nZUn0k/q7trG/Zll+AyRWGle740EI0UxLyxprGnGz7yci9IC5L/LllRL Pjn13sh2V3Lewf+eEBAtltUUgHF6FrRS4bRVIcSx5wdJh6Hp/X/wG64Z6ke3wTPAKJ OkNktJjYkdYB6dFwJiZxGDntEla3ysKqZBHky4r8= From: "bugdal at aerifal dot cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95558] New: Invalid IPA optimizations based on weak definition Date: Sat, 06 Jun 2020 03:45:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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 03:45:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95558 Bug ID: 95558 Summary: Invalid IPA optimizations based on weak definition Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bugdal at aerifal dot cx Target Milestone: --- Created attachment 48689 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48689&action=3Dedit test case Here is a case that came up in WIP code on musl libc, where I wanted to pro= vide a weak dummy definition for functionality that would optionally be replaced= by a strong definition elsewhere at ld time. I've been looking for some plausi= ble explanation aside from an IPA bug, like interaction with UB, but I can't fi= nd any. In the near-minimal test case here, the function reclaim() still has all of= the logic it should, but reclaim_gaps gets optimized down to a nop. What seems to be happening is that the dummy weak definition does not leak = into its direct caller via IPA optimizations, but does leak to the caller's call= er.=