From patchwork Mon Jan 15 09:41:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 84085 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E58E53857C77 for ; Mon, 15 Jan 2024 09:41:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 1DB283858034 for ; Mon, 15 Jan 2024 09:41:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DB283858034 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1DB283858034 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705311680; cv=none; b=XotczvzHhcXRih2LdBlWBLdtLmKBjnzJfaLiJAVj3l2ruukxHnCLTaRXUJh2DNJg5QqKhUEh4pJ4yN8vfpUZd8q0dRQkChYs6VFMOf1+oeU5uQw04dvWAFbfedx/dHLIXfXHVI5NemISfK4HeFQuZ+8aM80iNk8dvfgoOQUW4qc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705311680; c=relaxed/simple; bh=5SbCZMxa8ciyTCFWeBqOpoqUWKcSBU1PK/pCOFj5rys=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=kARj3cfsj6hsNZ7vTYJZWv66GyG0t/1zTG36Wa5XAIEIUozVpewf6ukwNYLeRU0JH3XpH1/v7ldIpqMP2QoCFFy2/+lzr1yIiw6ASf6SMmc0EqVE+FbiXRehlbbZO5hEzRrgVH0Re1Iup5Rt5bX6rIZJRQTA4kXwlgZ6I9yyVxk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6ddf1e88e51so3607170a34.0 for ; Mon, 15 Jan 2024 01:41:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705311678; x=1705916478; darn=gcc.gnu.org; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Mh73xhD2Xdkusdt0N5+nlDg8NC4BDiXdqij6i/h0Rlw=; b=CHixHpvCwIDW3WUmgGSIQPJUw8UmfZEA0HwthvYh9L5j+loGBptje62jWYwFETPwor sVLknXeQ6dWLpvJS228D+qDyZQq7IJwIOpJvZtJfYEJWAc77Xv3N94Z/7qaSp40aROj0 dAlU4Kpl2g0RPpD2YC50knuhjcx0nfI80exkrgiekLdSPHyIaYxYr++1iW/ei5XvFLRc 1GZuSlkz6UXP8gL2WVPTCPtbH3jza4vgw0MSrtOk+bSHFWsLdWtxZ+WiZ0r06sxMYHT9 wcFkdZS/FCCOzhc3zZrx67CNz0NzNIAYbxqCWgsLxKVyMujfrDTZlTpMsKuf5SWhfF2G V+Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705311678; x=1705916478; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mh73xhD2Xdkusdt0N5+nlDg8NC4BDiXdqij6i/h0Rlw=; b=vnkol3ltyetmf3hTUomuUrYghvW4ysepxpiarbfX0/uev1j7xWqOUVZTtAMSX92Csy 9GpTWMYOfQc619OStIZNlbuY/ZOLSauYSk+lyaQkmRI9JNMFJaCc09trBAmuJdDxcOWP CQDOYsda0qiRgZgDfRUsbKYuyV85Z6Lac1QAfmpFK9fPpo12j2Tpk8yytkyY4uvFyTD4 +5WS/Ncr2KC5snCHZ2xGa+m3UYe5jV2Fcc9QJaO1VcQRsrYs0v9RnsGGDBKNcB5veHpc aI1Tmn9oigWmSXuGCx5nMtUQygIBlmKZQbsu7da43ATd0NV81L0fVuVEO0qY2vtjWNeR Sm+g== X-Gm-Message-State: AOJu0YzDkYaHmu7ErEyXMw8eDZ6T7UI0QomkB4z6/RgE38Y1whwmr1zM EVHrrJIShQ7DLA8kpuNZq41HHzg9aK4= X-Google-Smtp-Source: AGHT+IEd8Qg0zaQR52syb/9HkWVxVgrfVPXclcAv3OmDfnpZMy3nApT9H4uwCNZ75gzYgDzsYLyfEQ== X-Received: by 2002:a9d:5907:0:b0:6dd:e168:b4a0 with SMTP id t7-20020a9d5907000000b006dde168b4a0mr5430557oth.16.1705311678345; Mon, 15 Jan 2024 01:41:18 -0800 (PST) Received: from Thaum. (123-243-206-49.tpgi.com.au. [123.243.206.49]) by smtp.gmail.com with ESMTPSA id ei6-20020a056a0080c600b006dae1c8c817sm7260274pfb.74.2024.01.15.01.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 01:41:18 -0800 (PST) Message-ID: <65a4fdbe.050a0220.b4d36.7277@mx.google.com> X-Google-Original-Message-ID: Date: Mon, 15 Jan 2024 20:41:14 +1100 From: Nathaniel Shead To: gcc-patches@gcc.gnu.org Cc: Jason Merrill Subject: [PATCH] c++: Fix ENABLE_SCOPE_CHECKING printing MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org While working on another bug, I noticed the ENABLE_SCOPE_CHECKING macro and thought to try it out. It caused selftest to ICE. This patch is a minimal fix to get it working again. Probably this should use a test to stop this regressing again in the future the next time new scope-kinds are added, but given it's dependent on a (almost certainly rarely-used) build-time macro I'm not sure exactly how you would do that? Or alternatively I could add a `sk_count` to the end of the scope kind list and `static_assert` that the size of the descriptor list matches? (Also not sure if this would be appropriate for stage 4 or if it should wait till next stage 1. I suppose this fixes a regression but I suspect this has been broken for a very long time.) -- >8 -- The lists of scope kinds used by ENABLE_SCOPE_CHECKING don't seem to have been updated in a long while, causing ICEs and confusing output. This patch brings the list into line. gcc/cp/ChangeLog: * name-lookup.cc (cp_binding_level_descriptor): Add missing scope kinds. Signed-off-by: Nathaniel Shead Signed-off-by: Nathaniel Shead --- gcc/cp/name-lookup.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index d827d337d3b..2e93ed183f1 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -4464,11 +4464,16 @@ cp_binding_level_descriptor (cp_binding_level *scope) "try-scope", "catch-scope", "for-scope", + "cond-init-scope", + "stmt-expr-scope", "function-parameter-scope", "class-scope", + "enum-scope", "namespace-scope", "template-parameter-scope", - "template-explicit-spec-scope" + "template-explicit-spec-scope", + "transaction-scope", + "openmp-scope" }; const scope_kind kind = scope->explicit_spec_p ? sk_template_spec : scope->kind;