From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B327E3858D38; Wed, 3 Jan 2024 16:26:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B327E3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704299172; bh=HI4XboUpmPljDXluA31Ml+RfbaQ5JdKQH8XtHP82gDo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GyuD4Vrg+PtYg2CCqZpnbbHHeFJKkDzSRkOMehZCcOs2Fginj5o8vKm+7KS/VOsxK LytCD3d3Jj9UymHm7XkjK1dvb9iSBE9MKK9oqxxVs0qgLFZTBV8+mPftvI/61UHra8 H/1cVXyJm+hxLT1lK4V6fTU9U34lcPTJQKxAgyYc= From: "stefan at bytereef dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/113203] __attribute__ ((always_inline)) fails with C99/LTO/-Og. Date: Wed, 03 Jan 2024 16:26:11 +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: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: stefan at bytereef dot org 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113203 --- Comment #4 from Stefan Krah --- > Or, if the intention is that all calls to the function within its TU > are inlined and not the other ones, split the function into two, one > always_inline which is used from within the TU and another one which > just calls it and is used from other TUs. Yes, that's the intention. The real project has more than 100 functions in mpdecimal.c. I'm using C99 inline to both automatically inline functions specifically in that TU but generate regular functions for the other TUs and libmpdec.so. C99 saves the work of creating the wrappers manually. Do note that this issue started with gcc-12, same as in: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107931 So it's a behavior change. I agree that the combination of "-flto -Og" is n= ot particularly important. But is it guaranteed that the above C99 scheme will always work with -O{1,2,3}? Or are there other loopholes that might show up in the future? I guess that in order to be safe I'll remove always_inline and use your wra= pper suggestion some time in the future.=