From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 340033858CDB; Fri, 3 Mar 2023 16:37:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 340033858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677861434; bh=67Rtl3OEeE+Xhu4uA90F3LRrn5FgRupt8rl/eJT9KyI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sDpmkSA1JgoFfcDWRecLs8+9FqcDnkiIr70DSEPlJP9wAbCjC2XzMfmjYAV+rL42A e+WnttI5ZabjDrt2yTf0107B7jjg4+aykjqRcUMXOSuZHotjIw8Lw2R+1ZoIybcGBJ bUKQGQbVngORHlVgnaENk4yorEw4M4slfdlesdKU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108998] [12/13 Regression] ICE in tsubst, at cp/pt.cc:16037 Date: Fri, 03 Mar 2023 16:37:13 +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: ASSIGNED X-Bugzilla-Resolution: 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 #5 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:341e6cd8d603a334fd34657a6b454176be1c6437 commit r13-6452-g341e6cd8d603a334fd34657a6b454176be1c6437 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.cc (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.=