From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6AAD13849ACF; Fri, 19 Apr 2024 20:21:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AAD13849ACF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713558085; bh=b0QX174Jw3N4slaSCYISFgiaahp/eSvHiOo5silywJY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wsVlOJuiT4fBmcx7Gm7XZMbWUc75sfkSn1P+HOBlKzw+ujroB6r2TMGlrZZAOMX6V 85llotcZ6hVSb3JNX4BQ81iVwlhqhdeJrfZFmzE0vrrfgQE/wAQ2g/0ksqkmrX4Uj/ S/P1lMGURmqDnhyxHXl55oYNKsiXeDCWYRYDRjWo= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/114784] [14 Regression] Inlining fails for always_inline inheriting constructor Date: Fri, 19 Apr 2024 20:21:24 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed cc bug_status cf_reconfirmed_on target_milestone 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114784 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 CC| |hubicka at gcc dot gnu.org, | |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2024-04-19 Target Milestone|--- |14.0 --- Comment #2 from Jakub Jelinek --- Started with r14-2149-gabdf0b6cdff5783b97f35ad61ae31433f0569dfd That said, if you just fix the warning (i.e. remove the UB from serenity_ma= in if it would ever return), then it compiles fine. Say by adding return 0; statement. But adding [[gnu::cold]] attribute to serenity_main makes it error again. Honza, I thought always_inline should have precedence over decisions if it inlines into cold code or not etc.? Or maybe always_inline attribute is copied over to the inheriting construct= ors but DECL_DISREGARD_INLINE_LIMITS is not? template struct VariantConstructors { __attribute__((always_inline)) VariantConstructors(int t) { base().set(t, {}); } __attribute__((always_inline)) VariantConstructors(long long t) { base().set(t, {}); } Base base(); }; struct Variant : VariantConstructors { using VariantConstructors::VariantConstructors; __attribute__((always_inline)) Variant(long long v) : VariantConstructors= (v) {} template void set(T &&, int); char m_data; }; struct ErrorOr { ErrorOr(int v) : a(v) { } ErrorOr(long long v) : a(v) { } Variant a; }; static ErrorOr run() { ErrorOr x(0); // compiles with this line removed ErrorOr y(0LL); return 0; } [[gnu::cold]] int serenity_main() { run(); return 0; }=