From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id A8D6B384AB58 for ; Fri, 3 May 2024 16:23:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8D6B384AB58 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A8D6B384AB58 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714753415; cv=none; b=rbedX8LYRn4cqTvu4FNWUlvIDjNpb+7K944MAE2H0QVVJaj0sFUIREVy+w/Nz9EJcpbRSG7JPh+7hu5oZoD8sqda31XEO1UHgf81jJh6u4ASDU1SX8/s3BLtABpEplQ/O39nccgd1BU72TZQBeiCAXVQUMasMiZpq5ki00jYiH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714753415; c=relaxed/simple; bh=/FAjoXbFdzztbngIDc00Db8xFEzgoT7IDLVTvK69Iuc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: Mime-Version:Subject:Date:Message-Id:To; b=XS6bbbp2W6J2qWcI00ee/ZU2WWUJkmIRmpVegIHD3xn1EVHgMDVGFl8IAsu/QFkAujc4SMRIq2ghS+A6za7y3LN6ltGr8xvPangrLGKL6QSE6Z9vV0/yIBAGIBA2+1MAVWXKZJHyzi3vddRTgZq5EAuGa8Rh/Yq92g/aIHD9vNE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 18BC320650; Fri, 3 May 2024 16:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714753411; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ADSaBtjStGQrtMkrfk61NEfL+P+sjVlJHHpF9ibsZeI=; b=qQ7Coeh/6+y1/WejGbVxPMjFqUthTRr85WfF4jFpy6ZOmTzzaVXzJz7756VCbqesB/EQV5 kB/DJIm0ycG7gFkBOEO94EOQoJbUIyfa/wutLOQYTvp+3oZ1hN9jZHadDwHsuY+eAbGSav 5LG33DxmTpTgjqO1koLC0lLQGNBN3D0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714753411; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ADSaBtjStGQrtMkrfk61NEfL+P+sjVlJHHpF9ibsZeI=; b=sD9OnDLG5fkRMNAU+hbZ6JFPqUaZUY92iZYUSC5E56gEJAmb1/gfUiXLO2/YhFJHWI/ize 6nsaEZp37T+oebDw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=NzfwEOs7; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=eTmzHoBd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714753410; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ADSaBtjStGQrtMkrfk61NEfL+P+sjVlJHHpF9ibsZeI=; b=NzfwEOs7Y0velD5DUa+3D84dHPJOkZNuI5Wgusho7UsuLaJRQJuo7HYgHC6Xv33RJeww1g A1/tVtIUGcMV0a8MOczZkRxO7KvJcKHUkhXnpl39+h878Hq7uRPGHXoqIUuPYKR5X9dtZZ pGP6pP9asoMTWqv7mg5j5lcDamAvqT0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714753410; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ADSaBtjStGQrtMkrfk61NEfL+P+sjVlJHHpF9ibsZeI=; b=eTmzHoBd1BroTp2MwEVJuQ5JumuBUPxRbbqfX9qAyG5mqY8sbY27ooAB0T5VM94ITFx9/1 o9zHzblyF3uazgBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F245613991; Fri, 3 May 2024 16:23:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id CpIdO4EPNWYtPgAAD6G6ig (envelope-from ); Fri, 03 May 2024 16:23:29 +0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] middle-end/114931 - type_hash_canon and structual equality types Date: Fri, 3 May 2024 18:23:19 +0200 Message-Id: <0D3EFE04-0E5E-4373-AECE-6B5CC6AA6379@suse.de> References: <3616afcc455c1f80e2bb8a80a408994a67062d85.camel@tugraz.at> Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek In-Reply-To: <3616afcc455c1f80e2bb8a80a408994a67062d85.camel@tugraz.at> To: Martin Uecker X-Mailer: iPhone Mail (21E236) X-Spam-Score: -6.51 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 18BC320650 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-6.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; APPLE_IOS_MAILER_COMMON(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,tugraz.at:email,attribs.cc:url,c-common.cc:url,tree.cc:url] X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Am 03.05.2024 um 17:33 schrieb Martin Uecker : >=20 > =EF=BB=BFAm Freitag, dem 03.05.2024 um 14:13 +0200 schrieb Richard Biener:= >> TYPE_STRUCTURAL_EQUALITY_P is part of our type system so we have >> to make sure to include that into the type unification done via >> type_hash_canon. This requires the flag to be set before querying >> the hash which is the biggest part of the patch. >=20 > I assume this does not affect structs / unions because they > do not make this mechanism of type unification (each tagged type > is a unique type), but only derived types that end up having > TYPE_STRUCTURAL_EQUALITY_P because they are constructed from > incomplete structs / unions before TYPE_CANONICAL is set. >=20 > I do not yet understand why this change is needed. Type > identity should not be affected by setting TYPE_CANONICAL, so > why do we need to keep such types separate? I understand that we > created some inconsistencies, but I do not see why this change > is needed to fix it. But I also haven't understood how we ended > up with a TYPE_CANONICAL having TYPE_STRUCTURAL_EQUALITY_P in > PR 114931 ... Because we created the canonical function type before where one of its argum= ents had TYPE_STEUCTURAL_EQUALITY which makes the function type so. Richard=20 >=20 > Martin >=20 >=20 >>=20 >> Bootstrapped and tested on x86_64-unknown-linux-gnu for all languages. >>=20 >> As said in the PR this merely makes sure to keep individual types >> consistent with themselves. We still will have a set of types >> with TYPE_STRUCTURAL_EQUALITY_P and a set without that might be >> otherwise identical. That could be only avoided with changes in >> the frontend. >>=20 >> OK for trunk? >>=20 >> Thanks, >> Richard. >>=20 >> PR middle-end/114931 >> gcc/ >> * tree.cc (type_hash_canon_hash): Hash TYPE_STRUCTURAL_EQUALITY_P. >> (type_cache_hasher::equal): Compare TYPE_STRUCTURAL_EQUALITY_P. >> (build_array_type_1): Set TYPE_STRUCTURAL_EQUALITY_P before >> probing with type_hash_canon. >> (build_function_type): Likewise. >> (build_method_type_directly): Likewise. >> (build_offset_type): Likewise. >> (build_complex_type): Likewise. >> * attribs.cc (build_type_attribute_qual_variant): Likewise. >>=20 >> gcc/c-family/ >> * c-common.cc (complete_array_type): Set TYPE_STRUCTURAL_EQUALITY_P >> before probing with type_hash_canon. >>=20 >> gcc/testsuite/ >> * gcc.dg/pr114931.c: New testcase. >> --- >> gcc/attribs.cc | 20 +++++----- >> gcc/c-family/c-common.cc | 11 ++++-- >> gcc/testsuite/gcc.dg/pr114931.c | 10 +++++ >> gcc/tree.cc | 65 +++++++++++++++++++++++---------- >> 4 files changed, 74 insertions(+), 32 deletions(-) >> create mode 100644 gcc/testsuite/gcc.dg/pr114931.c >>=20 >> diff --git a/gcc/attribs.cc b/gcc/attribs.cc >> index 12ffc5f170a..3ab0b0fd87a 100644 >> --- a/gcc/attribs.cc >> +++ b/gcc/attribs.cc >> @@ -1336,6 +1336,16 @@ build_type_attribute_qual_variant (tree otype, tre= e attribute, int quals) >> tree dtype =3D ntype =3D build_distinct_type_copy (ttype); >>=20 >> TYPE_ATTRIBUTES (ntype) =3D attribute; >> + /* If the target-dependent attributes make NTYPE different from >> + its canonical type, we will need to use structural equality >> + checks for this type. >> + >> + We shouldn't get here for stripping attributes from a type; >> + the no-attribute type might not need structural comparison. But >> + we can if was discarded from type_hash_table. */ >> + if (TYPE_STRUCTURAL_EQUALITY_P (ttype) >> + || !comp_type_attributes (ntype, ttype)) >> + SET_TYPE_STRUCTURAL_EQUALITY (ntype); >>=20 >> hashval_t hash =3D type_hash_canon_hash (ntype); >> ntype =3D type_hash_canon (hash, ntype); >> @@ -1343,16 +1353,6 @@ build_type_attribute_qual_variant (tree otype, tre= e attribute, int quals) >> if (ntype !=3D dtype) >> /* This variant was already in the hash table, don't mess with >> TYPE_CANONICAL. */; >> - else if (TYPE_STRUCTURAL_EQUALITY_P (ttype) >> - || !comp_type_attributes (ntype, ttype)) >> - /* If the target-dependent attributes make NTYPE different from >> - its canonical type, we will need to use structural equality >> - checks for this type. >> - >> - We shouldn't get here for stripping attributes from a type; >> - the no-attribute type might not need structural comparison. But >> - we can if was discarded from type_hash_table. */ >> - SET_TYPE_STRUCTURAL_EQUALITY (ntype); >> else if (TYPE_CANONICAL (ntype) =3D=3D ntype) >> TYPE_CANONICAL (ntype) =3D TYPE_CANONICAL (ttype); >>=20 >> diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc >> index 01e3d247fc2..032dcb4b41d 100644 >> --- a/gcc/c-family/c-common.cc >> +++ b/gcc/c-family/c-common.cc >> @@ -7115,6 +7115,13 @@ complete_array_type (tree *ptype, tree initial_val= ue, bool do_default) >> TYPE_TYPELESS_STORAGE (main_type) =3D TYPE_TYPELESS_STORAGE (type); >> layout_type (main_type); >>=20 >> + /* Set TYPE_STRUCTURAL_EQUALITY_P early. */ >> + if (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (main_type)) >> + || TYPE_STRUCTURAL_EQUALITY_P (TYPE_DOMAIN (main_type))) >> + SET_TYPE_STRUCTURAL_EQUALITY (main_type); >> + else >> + TYPE_CANONICAL (main_type) =3D main_type; >> + >> /* Make sure we have the canonical MAIN_TYPE. */ >> hashval_t hashcode =3D type_hash_canon_hash (main_type); >> main_type =3D type_hash_canon (hashcode, main_type); >> @@ -7122,7 +7129,7 @@ complete_array_type (tree *ptype, tree initial_valu= e, bool do_default) >> /* Fix the canonical type. */ >> if (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (main_type)) >> || TYPE_STRUCTURAL_EQUALITY_P (TYPE_DOMAIN (main_type))) >> - SET_TYPE_STRUCTURAL_EQUALITY (main_type); >> + gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (main_type)); >> else if (TYPE_CANONICAL (TREE_TYPE (main_type)) !=3D TREE_TYPE (main_ty= pe) >> || (TYPE_CANONICAL (TYPE_DOMAIN (main_type)) >> !=3D TYPE_DOMAIN (main_type))) >> @@ -7130,8 +7137,6 @@ complete_array_type (tree *ptype, tree initial_valu= e, bool do_default) >> =3D build_array_type (TYPE_CANONICAL (TREE_TYPE (main_type)), >> TYPE_CANONICAL (TYPE_DOMAIN (main_type)), >> TYPE_TYPELESS_STORAGE (main_type)); >> - else >> - TYPE_CANONICAL (main_type) =3D main_type; >>=20 >> if (quals =3D=3D 0) >> type =3D main_type; >> diff --git a/gcc/testsuite/gcc.dg/pr114931.c b/gcc/testsuite/gcc.dg/pr114= 931.c >> new file mode 100644 >> index 00000000000..d690ed70e52 >> --- /dev/null >> +++ b/gcc/testsuite/gcc.dg/pr114931.c >> @@ -0,0 +1,10 @@ >> +/* { dg-do compile } */ >> +/* { dg-options "-std=3Dc23" } */ >> + >> +struct Tcl_Obj; >> +void(Tcl_FreeInternalRepProc)(struct Tcl_Obj *); >> +typedef struct Tcl_Obj { >> +} Tcl_Obj; >> +struct { >> + void (*tclFreeObj)(Tcl_Obj *); >> +} Tcl_InitStubs; >> diff --git a/gcc/tree.cc b/gcc/tree.cc >> index 780662549fe..6564b002dc1 100644 >> --- a/gcc/tree.cc >> +++ b/gcc/tree.cc >> @@ -6012,6 +6012,8 @@ type_hash_canon_hash (tree type) >>=20 >> hstate.add_int (TREE_CODE (type)); >>=20 >> + hstate.add_flag (TYPE_STRUCTURAL_EQUALITY_P (type)); >> + >> if (TREE_TYPE (type)) >> hstate.add_object (TYPE_HASH (TREE_TYPE (type))); >>=20 >> @@ -6109,6 +6111,10 @@ type_cache_hasher::equal (type_hash *a, type_hash *= b) >> || TYPE_MODE (a->type) !=3D TYPE_MODE (b->type))) >> return false; >>=20 >> + if (TYPE_STRUCTURAL_EQUALITY_P (a->type) >> + !=3D TYPE_STRUCTURAL_EQUALITY_P (b->type)) >> + return false; >> + >> switch (TREE_CODE (a->type)) >> { >> case VOID_TYPE: >> @@ -7347,6 +7353,14 @@ build_array_type_1 (tree elt_type, tree index_type= , bool typeless_storage, >> TYPE_DOMAIN (t) =3D index_type; >> TYPE_ADDR_SPACE (t) =3D TYPE_ADDR_SPACE (elt_type); >> TYPE_TYPELESS_STORAGE (t) =3D typeless_storage; >> + >> + /* Set TYPE_STRUCTURAL_EQUALITY_P. */ >> + if (set_canonical >> + && (TYPE_STRUCTURAL_EQUALITY_P (elt_type) >> + || (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type)) >> + || in_lto_p)) >> + SET_TYPE_STRUCTURAL_EQUALITY (t); >> + >> layout_type (t); >>=20 >> if (shared) >> @@ -7363,7 +7377,7 @@ build_array_type_1 (tree elt_type, tree index_type,= bool typeless_storage, >> if (TYPE_STRUCTURAL_EQUALITY_P (elt_type) >> || (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type)) >> || in_lto_p) >> - SET_TYPE_STRUCTURAL_EQUALITY (t); >> + gcc_unreachable (); >> else if (TYPE_CANONICAL (elt_type) !=3D elt_type >> || (index_type && TYPE_CANONICAL (index_type) !=3D index_type))= >> TYPE_CANONICAL (t) >> @@ -7510,21 +7524,25 @@ build_function_type (tree value_type, tree arg_ty= pes, >> TYPE_NO_NAMED_ARGS_STDARG_P (t) =3D 1; >> } >>=20 >> - /* If we already have such a type, use the old one. */ >> - hashval_t hash =3D type_hash_canon_hash (t); >> - tree probe_type =3D t; >> - t =3D type_hash_canon (hash, t); >> - if (t !=3D probe_type) >> - return t; >> - >> /* Set up the canonical type. */ >> any_structural_p =3D TYPE_STRUCTURAL_EQUALITY_P (value_type); >> any_noncanonical_p =3D TYPE_CANONICAL (value_type) !=3D value_type; >> canon_argtypes =3D maybe_canonicalize_argtypes (arg_types, >> &any_structural_p, >> &any_noncanonical_p); >> + /* Set TYPE_STRUCTURAL_EQUALITY_P early. */ >> if (any_structural_p) >> SET_TYPE_STRUCTURAL_EQUALITY (t); >> + >> + /* If we already have such a type, use the old one. */ >> + hashval_t hash =3D type_hash_canon_hash (t); >> + tree probe_type =3D t; >> + t =3D type_hash_canon (hash, t); >> + if (t !=3D probe_type) >> + return t; >> + >> + if (any_structural_p) >> + gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (t)); >> else if (any_noncanonical_p) >> TYPE_CANONICAL (t) =3D build_function_type (TYPE_CANONICAL (value_typ= e), >> canon_argtypes); >> @@ -7667,13 +7685,6 @@ build_method_type_directly (tree basetype, >> argtypes =3D tree_cons (NULL_TREE, ptype, argtypes); >> TYPE_ARG_TYPES (t) =3D argtypes; >>=20 >> - /* If we already have such a type, use the old one. */ >> - hashval_t hash =3D type_hash_canon_hash (t); >> - tree probe_type =3D t; >> - t =3D type_hash_canon (hash, t); >> - if (t !=3D probe_type) >> - return t; >> - >> /* Set up the canonical type. */ >> any_structural_p >> =3D (TYPE_STRUCTURAL_EQUALITY_P (basetype) >> @@ -7684,8 +7695,20 @@ build_method_type_directly (tree basetype, >> canon_argtypes =3D maybe_canonicalize_argtypes (TREE_CHAIN (argtypes), >> &any_structural_p, >> &any_noncanonical_p); >> + >> + /* Set TYPE_STRUCTURAL_EQUALITY_P early. */ >> if (any_structural_p) >> SET_TYPE_STRUCTURAL_EQUALITY (t); >> + >> + /* If we already have such a type, use the old one. */ >> + hashval_t hash =3D type_hash_canon_hash (t); >> + tree probe_type =3D t; >> + t =3D type_hash_canon (hash, t); >> + if (t !=3D probe_type) >> + return t; >> + >> + if (any_structural_p) >> + gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (t)); >> else if (any_noncanonical_p) >> TYPE_CANONICAL (t) >> =3D build_method_type_directly (TYPE_CANONICAL (basetype), >> @@ -7726,6 +7749,9 @@ build_offset_type (tree basetype, tree type) >>=20 >> TYPE_OFFSET_BASETYPE (t) =3D TYPE_MAIN_VARIANT (basetype); >> TREE_TYPE (t) =3D type; >> + if (TYPE_STRUCTURAL_EQUALITY_P (basetype) >> + || TYPE_STRUCTURAL_EQUALITY_P (type)) >> + SET_TYPE_STRUCTURAL_EQUALITY (t); >>=20 >> /* If we already have such a type, use the old one. */ >> hashval_t hash =3D type_hash_canon_hash (t); >> @@ -7741,7 +7767,7 @@ build_offset_type (tree basetype, tree type) >> { >> if (TYPE_STRUCTURAL_EQUALITY_P (basetype) >> || TYPE_STRUCTURAL_EQUALITY_P (type)) >> - SET_TYPE_STRUCTURAL_EQUALITY (t); >> + gcc_unreachable (); >> else if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (basetype)) !=3D basetyp= e >> || TYPE_CANONICAL (type) !=3D type) >> TYPE_CANONICAL (t) >> @@ -7770,6 +7796,8 @@ build_complex_type (tree component_type, bool named= ) >> tree probe =3D make_node (COMPLEX_TYPE); >>=20 >> TREE_TYPE (probe) =3D TYPE_MAIN_VARIANT (component_type); >> + if (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (probe))) >> + SET_TYPE_STRUCTURAL_EQUALITY (probe); >>=20 >> /* If we already have such a type, use the old one. */ >> hashval_t hash =3D type_hash_canon_hash (probe); >> @@ -7781,11 +7809,10 @@ build_complex_type (tree component_type, bool nam= ed) >> out the type. We need to check the canonicalization and >> maybe set the name. */ >> gcc_checking_assert (COMPLETE_TYPE_P (t) >> - && !TYPE_NAME (t) >> - && TYPE_CANONICAL (t) =3D=3D t); >> + && !TYPE_NAME (t)); >>=20 >> if (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (t))) >> - SET_TYPE_STRUCTURAL_EQUALITY (t); >> + ; >> else if (TYPE_CANONICAL (TREE_TYPE (t)) !=3D TREE_TYPE (t)) >> TYPE_CANONICAL (t) >> =3D build_complex_type (TYPE_CANONICAL (TREE_TYPE (t)), named); >=20