From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7810) id 229783846406; Mon, 13 Jun 2022 10:14:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 229783846406 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alex Coplan To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] cp: Another capability vtable fix X-Act-Checkin: gcc X-Git-Author: Alex Coplan X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: b479d8363d3f0387747de0d039ad9870d3908624 X-Git-Newrev: 53e245a972259a371500222549d64d73a09f8c27 Message-Id: <20220613101401.229783846406@sourceware.org> Date: Mon, 13 Jun 2022 10:14:01 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2022 10:14:01 -0000 https://gcc.gnu.org/g:53e245a972259a371500222549d64d73a09f8c27 commit 53e245a972259a371500222549d64d73a09f8c27 Author: Alex Coplan Date: Tue May 10 10:02:33 2022 +0100 cp: Another capability vtable fix Make sure to use capabilities consistently in vtable entries. This fixes ICEs in varasm.c:output_constructor_regular_field. Diff: --- gcc/cp/class.c | 6 +++--- gcc/cp/cp-tree.h | 2 ++ gcc/cp/decl.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 99c4c0c8745..cf69361b86a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -9818,7 +9818,7 @@ build_vtbl_initializer (tree binfo, with erroneous values (though harmless, apart from relocation costs). */ if (BV_LOST_PRIMARY (v)) - init = size_zero_node; + init = null_vtable_entry; if (! init) { @@ -9885,7 +9885,7 @@ build_vtbl_initializer (tree binfo, if (DECL_DESTRUCTOR_P (fn_original) && (CLASSTYPE_PURE_VIRTUALS (DECL_CONTEXT (fn_original)) || orig_binfo != binfo)) - init = size_zero_node; + init = null_vtable_entry; } } @@ -9893,7 +9893,7 @@ build_vtbl_initializer (tree binfo, if (TARGET_VTABLE_USES_DESCRIPTORS) { int i; - if (init == size_zero_node) + if (init == null_vtable_entry) for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i) CONSTRUCTOR_APPEND_ELT (*inits, size_int (jx++), init); else diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5a0c77b118d..af71fac2441 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -117,6 +117,7 @@ enum cp_tree_index { CPTI_WCHAR_DECL, CPTI_VTABLE_ENTRY_TYPE, + CPTI_NULL_VTABLE_ENTRY, CPTI_DELTA_TYPE, CPTI_VTABLE_INDEX_TYPE, CPTI_CLEANUP_TYPE, @@ -221,6 +222,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] +#define null_vtable_entry cp_global_trees[CPTI_NULL_VTABLE_ENTRY] /* The type used to represent an offset by which to adjust the `this' pointer in pointer-to-member types. */ #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE] diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fc88567a3cf..b647e925ab7 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4377,6 +4377,7 @@ cxx_init_decl_processing (void) layout_type (vfunc_type); vtable_entry_type = build_pointer_type (vfunc_type); + null_vtable_entry = build_int_cst (vtable_entry_type, 0); } record_builtin_type (RID_MAX, "__vtbl_ptr_type", vtable_entry_type);