From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 02D5D38555B9; Mon, 22 May 2023 03:12:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02D5D38555B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684725149; bh=HQZIJCmq+rYZZXB6kQ6G8zKlQ6CtUka12W9pa9sVSCM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bM6i9l+Y5vSonYfquftEKVDosCTJr1biXOQdIYka/jYXwcqtMHg+acRUeBEYcUgAd Ggfk6kWyUuoVW0FXSMTyVn6POHGLHBKNhGk3BMP/kwoyLI6NvpsANVWNpJzGZIfFcX 7GHiwNj6b7BMBNkBjkJqYti2bt+TJaZ0e7u9xOEE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108998] [12 Regression] ICE in tsubst, at cp/pt.cc:16037 Date: Mon, 22 May 2023 03:12:28 +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-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108998 --- Comment #9 from CVS Commits --- The releases/gcc-11 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:143179f27ebe6707d833802aaf4efb5d30a55001 commit r11-10805-g143179f27ebe6707d833802aaf4efb5d30a55001 Author: Patrick Palka Date: Fri Mar 3 11:37:02 2023 -0500 c++: thinko in extract_local_specs [PR108998] In order to fix PR100295, r13-4730-g18499b9f848707 attempted to make extract_local_specs walk the given pattern twice, ignoring unevaluated operands the first time around so that we prefer to process a local specialization in an evaluated context if it appears in one (we process each local specialization once even if it appears multiple times in the pattern). But there's a thinko in the patch, namely that we don't actually walk the pattern twice since we don't clear the visited set for the second walk (to avoid processing a local specialization twice) and so the root node (and any node leading up to an unevaluated operand) is considered visited already. So the patch effectively made extract_local_specs ignore unevaluated operands altogether, which this testcase demonstrates isn't quite safe (extract_local_specs never sees 'aa' and we don't reco= rd its local specialization, so later we try to specialize 'aa' on the spot with the args {{int},{17}} which causes us to nonsensically substitute its auto with 17.) This patch fixes this by refining the second walk to start from the trees we skipped over during the first walk. PR c++/108998 gcc/cp/ChangeLog: * pt.c (el_data::skipped_trees): New data member. (extract_locals_r): Push to skipped_trees any unevaluated contexts that we skipped over. (extract_local_specs): For the second walk, start from each tree in skipped_trees. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-generic11.C: New test. (cherry picked from commit 341e6cd8d603a334fd34657a6b454176be1c6437)=