From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEADD385AC38; Thu, 17 Feb 2022 22:51:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEADD385AC38 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104539] Failed to inline a very simple template function when it's explicit instantiated. Date: Thu, 17 Feb 2022 22:51:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason 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: Thu, 17 Feb 2022 22:51:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104539 --- Comment #4 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:2c9b7077b72529fbbe896212a0088bff6025c5e7 commit r12-7288-g2c9b7077b72529fbbe896212a0088bff6025c5e7 Author: Jason Merrill Date: Thu Feb 17 00:04:21 2022 -0500 c++: inlining explicit instantiations [PR104539] The PR10968 fix cleared DECL_COMDAT to force output of explicit instantiations. Then the PR59469 fix added a call to mark_needed, after which we no longer need to clear DECL_COMDAT, and leaving it set allows= us to inline explicit instantiations without worrying about symbol interposition. I suppose there's an argument to be made that an explicit instantiation declaration (extern template) should clear DECL_COMDAT, since that sugg= ests that there will be only a single instantiation somewhere that could be subject to interposition, but that doesn't change the 'inline' semantic= s, and it seems cleaner to treat template instantiations uniformly. PR c++/104539 gcc/cp/ChangeLog: * pt.cc (mark_decl_instantiated): Don't clear DECL_COMDAT. gcc/testsuite/ChangeLog: * g++.dg/ipa/inline-4.C: New test.=