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: 188091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1598751dyc; Mon, 15 Jan 2024 01:42:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2EiWpkKXAYHjJHDIzz4wtky5L9Tb8waZ9JWAqXRR46N5Qa31E8M8rBMMjU64QTjczoWnl X-Received: by 2002:a05:6214:62e:b0:680:bcc:830f with SMTP id a14-20020a056214062e00b006800bcc830fmr7847528qvx.85.1705311740489; Mon, 15 Jan 2024 01:42:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705311740; cv=pass; d=google.com; s=arc-20160816; b=ILs7MSl4oBHD1qkxh7dVkcEjS5luxu974ppvAaleLNnVyz9WqF0oJr+Xhbd17BpqmP X03axfzzXyb0rGnjUb9pjmofKUURhPKi2JTNBOECIGba5HGfGl1JjTXWT4igUSjso3Nv 2hrfFX8ve7kaW7xhU775hY3xRqbOqKp2K8G0r9X9/vaVqddZKBIfL5Z9PQAtDcimhJrP KcNIezRnJ6Gt0c445uK4H/tP0FxNfWyzHOQV5mHy84ZYtxnS2JiBE7VNUqgUhAxnJPG+ xFSLLES8Nku3TcIY75z4wcS9H+2K8xffkCji7ToD0GSNy6OZkBNwU8FHUfGztmuWW+Ps 90pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:subject:cc:to:from:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Mh73xhD2Xdkusdt0N5+nlDg8NC4BDiXdqij6i/h0Rlw=; fh=Px0ai+PRlAML1LDC3BukPvCf8nEgqik/SD+oF2SuaP0=; b=HfIA9t2/e4C9cJ7Gk5YavBC+4bsChzYTvrv4RG3soyi7EHsj6bRk9hl5CWKfYJ0I7G +uF5x+ishhhK7bPx1FgDRTGWogwcTRMTBO5qNrd/CcGUvKyvUy0/M8qg6F8J5qCviQMw 2sAtcaNTwgwr1c6w3k1PZt3s8T5zb9qmmSlCKMqJvCH8iBzCGPmao6EJg+t178Swnoxb exQDM/+Oif4IXe6xTf8VaAl9io3EaDEC71m5IjPqTQyX0w8X5n5wjTRga52WKHt03Eou A3bg48ynqAiOCWULBdeS4zx8pme+ifo635kJit5Xkn7t5EvKBLy0s4qmeH0mNCsRxuxS cOSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CHixHpvC; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d6-20020a0ce446000000b0068060842311si7560072qvm.371.2024.01.15.01.42.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 01:42:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CHixHpvC; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 347303858C2F for ; Mon, 15 Jan 2024 09:42:20 +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-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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788148963986801189 X-GMAIL-MSGID: 1788148963986801189 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;