From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5127F3858418; Thu, 7 Apr 2022 07:15:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5127F3858418 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102586] [12 Regression] ICE in clear_padding_type, at gimple-fold.c:4798 since r12-3433-ga25e0b5e6ac8a77a Date: Thu, 07 Apr 2022 07:15:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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, 07 Apr 2022 07:15:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586 --- Comment #30 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:46c739d40c6c1028295931c53cf414d581519072 commit r12-8042-g46c739d40c6c1028295931c53cf414d581519072 Author: Jakub Jelinek Date: Thu Apr 7 09:14:07 2022 +0200 c++: Handle __builtin_clear_padding on non-trivially-copyable types [PR102586] On Fri, Feb 11, 2022 at 07:55:50PM +0100, Jakub Jelinek via Gcc-patches wrote: > Something like the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586#c16 > will still be needed with adjusted testcase from > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586#c15 such that > __builtin_clear_padding is called directly on var addresses rather th= an > in separate functions. Here is an updated version of the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586#c15 patch which uses FIELD_DECL in the langhook instead of its TREE_TYPE, and the testcases have been adjusted for the builtin accepting pointers to non-trivially-copyable types only if it is address of a declaration. 2022-04-07 Jakub Jelinek PR tree-optimization/102586 gcc/ * langhooks.h (struct lang_hooks_for_types): Add classtype_as_b= ase langhook. * langhooks-def.h (LANG_HOOKS_CLASSTYPE_AS_BASE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it. * gimple-fold.cc (clear_padding_type): Use ftype instead of TREE_TYPE (field) some more. For artificial FIELD_DECLs without name try the lang_hooks.types.classtype_as_base langhook and if it returns non-NULL, use that instead of ftype for recursive call. gcc/cp/ * cp-objcp-common.h (cp_classtype_as_base): Declare. (LANG_HOOKS_CLASSTYPE_AS_BASE): Redefine. * cp-objcp-common.cc (cp_classtype_as_base): New function. gcc/testsuite/ * g++.dg/torture/builtin-clear-padding-5.C: New test. * g++.dg/cpp2a/builtin-clear-padding1.C (bar): Uncomment one call that is now accepted.=