From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 16187385DC30; Mon, 14 Mar 2022 09:49:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16187385DC30 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: Mon, 14 Mar 2022 09:49:34 +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: Mon, 14 Mar 2022 09:49:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586 --- Comment #29 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:c879b92c30d088ff01eb0c3e912eb8a01f9fc6e3 commit r12-7641-gc879b92c30d088ff01eb0c3e912eb8a01f9fc6e3 Author: Jakub Jelinek Date: Mon Mar 14 10:47:38 2022 +0100 c++: Reject __builtin_clear_padding on non-trivially-copyable types with one exception [PR102586] As mentioned by Jason in the PR, non-trivially-copyable types (or non-P= OD for purposes of layout?) types can be base classes of derived classes in which the padding in those non-trivially-copyable types can be reused f= or some real data members or even the layout can change and data members c= an be moved to other positions. __builtin_clear_padding is right now used for multiple purposes, in where it isn't used yet but was planned as the main spot it can be used for trivially copyable types only, ditto for std::bit_ca= st where we also use it. It is used for OpenMP long double atomics too but long double is trivially copyable, and lastly for -ftrivial-auto-var-in= it=3D. The following patch restricts the builtin to pointers to trivially-copy= able types, with the exception when it is called directly on an address of a variable, in that case already the FE can verify it is the complete obj= ect type and so it is safe to clear all the paddings in it. 2022-03-14 Jakub Jelinek PR tree-optimization/102586 gcc/ * doc/extend.texi (__builtin_clear_padding): Clearify that for = C++ argument type should be pointer to trivially-copyable type unle= ss it is address of a variable or parameter. gcc/cp/ * call.cc (build_cxx_call): Diagnose __builtin_clear_padding wh= ere first argument's type is pointer to non-trivially-copyable type unless it is address of a variable or parameter. gcc/testsuite/ * g++.dg/cpp2a/builtin-clear-padding1.C: New test.=