From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1EC293858C3A; Mon, 17 Apr 2023 12:44:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EC293858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681735482; bh=nafdXimO+EqNtbPblQLOZOyuwWjMLhP3Zm0TBjo4Pqs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mBZiTqIWCQDCLr43LeKkS/agdbtoz3CijUfpKUVRkn730MGe4zf2Ga25vZIjuIXZk IQJ4hwangVCEB0bntAOX//CxUSOLZfzkWSjTBS4iC2f+nQGeubVwNHq2WZzc/P3cb6 3w4/gzldxoDWawm00unnHvNIKW/thHSKLZtCGOf0= From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109531] [13 Regression] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value since r13-3292-gc2565a31c1622a Date: Mon, 17 Apr 2023 12:44:41 +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: 13.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka 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: 13.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109531 --- Comment #12 from Patrick Palka --- I suppose we're just neglecting to canonicalize a bound ttp's substituted a= rgs before determining its canonical type. Adding a call to coerce_template_pa= rms or canonicalize_type_argument seems to fix it: diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index fcc8e0d1d57..5ff91414f69 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -16285,9 +16285,18 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) return error_mark_node; tree argvec =3D tsubst (TI_ARGS (tinfo), args, complain, in_decl); + // this fixes it + tree tparms =3D DECL_INNERMOST_TEMPLATE_PARMS (tmpl); + argvec =3D coerce_template_parms (tparms, argvec, + tmpl, complain); if (argvec =3D=3D error_mark_node) return error_mark_node; + // or this + for (tree& arg : tree_vec_range (argvec)) + if (TYPE_P (arg)) + arg =3D canonicalize_type_argument (arg, complain); + TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (r) =3D build_template_info (tmpl, argvec); }=