From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 236A43858413; Fri, 7 Jan 2022 09:09:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 236A43858413 From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103769] [11/12 Regression] checking ICE in hashtab_chk_error with alias template and pack expansion after r11-7931 Date: Fri, 07 Jan 2022 09:09:16 +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: 12.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 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: Fri, 07 Jan 2022 09:09:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103769 --- Comment #6 from Sergei Trofimovich --- Trying to understand what the error means: Crash happens when we look up entry in gcc/cp/pt.c:static GTY (()) spec_hash_table *type_specializations; It's a hash table of entries of spec_entry type: struct GTY((for_user)) spec_entry { tree tmpl; /* The general template this is a specialization of. */ tree args; /* The args for this (maybe-partial) specialization. */ tree spec; /* The specialization itself. */ }; spec_hasher type defines both hasher and equality. hash is defined on fields 'tmpl' and 'args', equality is defined on 'tmpl', 'args' and sometimes 'spe= c': bool spec_hasher::equal (spec_entry *e1, spec_entry *e2) { int equal; ++comparing_specializations; ++comparing_dependent_aliases; ++processing_template_decl; equal =3D (e1->tmpl =3D=3D e2->tmpl && comp_template_args (e1->args, e2->args)); if (equal && flag_concepts /* tmpl could be a FIELD_DECL for a capture pack. */ && TREE_CODE (e1->tmpl) =3D=3D TEMPLATE_DECL && VAR_P (DECL_TEMPLATE_RESULT (e1->tmpl)) && uses_template_parms (e1->args)) { /* Partial specializations of a variable template can be distinguishe= d by constraints. */ tree c1 =3D e1->spec ? get_constraints (e1->spec) : NULL_TREE; tree c2 =3D e2->spec ? get_constraints (e2->spec) : NULL_TREE; equal =3D equivalent_constraints (c1, c2); } --processing_template_decl; --comparing_dependent_aliases; --comparing_specializations; return equal; } static hashval_t hash_tmpl_and_args (tree tmpl, tree args) { hashval_t val =3D iterative_hash_object (DECL_UID (tmpl), 0); return iterative_hash_template_arg (args, val); } hashval_t spec_hasher::hash (spec_entry *e) { return hash_tmpl_and_args (e->tmpl, e->args); } How can hash differ when values match?=