From patchwork Fri Feb 9 21:50:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1897256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=X8ymd4dI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TWnbG2gZKz23h8 for ; Sat, 10 Feb 2024 08:50:34 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5ADE6385840B for ; Fri, 9 Feb 2024 21:50:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 86B393858C39 for ; Fri, 9 Feb 2024 21:50:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86B393858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 86B393858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707515412; cv=none; b=kgBufXFw2jVYqhhIYTCy2JICB/WPPZs80C+vLh8Hu9ZtaZGIOqml0QEMcV73wfSkrIetzbXVS9AFAaf+EWiIp8WNNgRwAkmjpQZ40zVOCTnTvYaHnJ2XYED9+Df3dPsLhmLTUE5dmDpsTUSHXoJnizbwf/KWTB7GZQuEFY5ZxVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707515412; c=relaxed/simple; bh=YLGqOplDmVk4mW32prPSzh1PkIDSLmXBfXMVqo77N9k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RVFj/H6l9At4pZe1HJV6zQ6+Qy6Fx79f0+jeqbnhTgbvesTqfjDIUWkwu38M19cCTyMCNnPpGKBQAAMmvkZedNHhggFY1JtphydvuitmEWQSg3fFDl43HsTTMwASV3sLw5duMTV2Cff6qrhNoWcH4TuI83Mq+fv+f5X6JdSiSFQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707515411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sAh13PILOxPwUNmChodx9BhrUB3wspZutLQfshL+jcE=; b=X8ymd4dIKzYFm860MKOXRjpjkkHCs67sX5hy6fqD9xps5oqFKglr1cqfFxaOPyTCDg3AZJ tBhdd/R9fz/esaRucPFCSCMUTAbOwvzfQhlKr6vtdEppLfrmyNZAXOifoGHTagVIYPUGCr 1sSQddu/eWzezpV4iiA6894svX1Jsjg= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-114-sN4pQ4XWOkiAdmDQPHmJsg-1; Fri, 09 Feb 2024 16:50:10 -0500 X-MC-Unique: sN4pQ4XWOkiAdmDQPHmJsg-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-42c4a173008so11699671cf.0 for ; Fri, 09 Feb 2024 13:50:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707515408; x=1708120208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sAh13PILOxPwUNmChodx9BhrUB3wspZutLQfshL+jcE=; b=D46ahylPR+3WI5We8FZFWcEGS2OZYnCt3ABJDyYdgUNFbNzf4xTf+tZDgfbRSOE5kc R3JkwIAQpCr3Sh/1QK4qN7jwngEyIDPUkgSaMdyXWJBwY3jyJE+2mPL53Jz9KSukLNfU uxYAG0C+XONjjkunnlMK+iJYr5ws8YqtpfuhCiiK9G00NHz1rBvMJenzBWICqqUV7kD/ PkPih8Ca7d/D9fMjrud5JZNNzUPv2dc2PO+ude2ps49aUQRdTP9MwwPIrzSEq/Ajn40G Aab5uy4+RIYIVYnNvvQqwMqIy+kusGGo1+nv0GhCqt6+6aOl5gDiusObM35GRyIgxKJx jexw== X-Gm-Message-State: AOJu0Yz9WpxiweBtwxMsI9vtSsk7qZJWhGqDw9/VfwcggY+LP38NROkO CTjS34G+NCNmMDsSAbSg7uzg9DvFy+tXoMvH5BffnjMhxuvMhSIy9RxS5Jr/t+nXi66eE5sRXbP U/GuE5cL4OYERxKgfdinkMR3rrgBDF2QNdpF5eTqNspCCSmTs5ZkaSPm1hfypA53SYQrijb3RTs E4x7bd57OdJwDthuI/wTNgaXOUr08f7zKJ/44x X-Received: by 2002:a05:622a:8095:b0:42c:64fa:604c with SMTP id js21-20020a05622a809500b0042c64fa604cmr242552qtb.2.1707515408442; Fri, 09 Feb 2024 13:50:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQ2EsMR9hCSLzx2Qk2mtxXdz8gwWaC2AgNDBqJDPGUPCly+76MiO17/crOYyIJ8NrU/uR6nQ== X-Received: by 2002:a05:622a:8095:b0:42c:64fa:604c with SMTP id js21-20020a05622a809500b0042c64fa604cmr242539qtb.2.1707515408128; Fri, 09 Feb 2024 13:50:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWHhUrtrYDIHSCsj5s0gUSut7NZwRSq9kxb2jYisn9YzaZTsqsAC9bq3EiL56P/RA+WoeYoohlY2md3to/I8UdzI6pdU51b/sCXzc4RbpjsKnI= Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id kr21-20020ac861d5000000b0042c594ee9c2sm930133qtb.63.2024.02.09.13.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 13:50:06 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, nathan@acm.org, Patrick Palka Subject: [PATCH 2/2] c++/modules: ICE with modular fmtlib Date: Fri, 9 Feb 2024 16:50:01 -0500 Message-ID: <20240209215001.1196422-2-ppalka@redhat.com> X-Mailer: git-send-email 2.43.0.561.g235986be82 In-Reply-To: <20240209215001.1196422-1-ppalka@redhat.com> References: <20240209215001.1196422-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? I'll try to reduce and add testcases overnight for these separate bugs before pushing. -- >8 -- Building modular fmtlib triggered two small modules bugs in C++23 and C++26 mode respectively (due to libstdc++ header differences). The first is that a TEMPLATE_DECL having DECL_LANG_SPECIFIC doesn't necessarily imply that its DECL_TEMPLATE_RESULT has DECL_LANG_SPECIFIC. So we need to use STRIP_TEMPLATE consistently; this is a follow-up to r12-7187-gdb84f382ae3dc2. The second is that get_originating_module_decl was ICEing on class-scope enumerators injected via using-enum. gcc/cp/ChangeLog: * module.cc (depset::hash::add_specializations): Use STRIP_TEMPLATE consistently. (get_originating_module_decl): Handle class-scope CONST_DECL. --- gcc/cp/module.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 3c2fef0e3f4..659fa03dae1 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13248,7 +13248,7 @@ depset::hash::add_specializations (bool decl_p) if (use_tpl == 1) /* Implicit instantiations only walked if we reach them. */ needs_reaching = true; - else if (!DECL_LANG_SPECIFIC (spec) + else if (!DECL_LANG_SPECIFIC (STRIP_TEMPLATE (spec)) || !DECL_MODULE_PURVIEW_P (STRIP_TEMPLATE (spec))) /* Likewise, GMF explicit or partial specializations. */ needs_reaching = true; @@ -18708,7 +18708,8 @@ get_originating_module_decl (tree decl) && (TREE_CODE (DECL_CONTEXT (decl)) == ENUMERAL_TYPE)) decl = TYPE_NAME (DECL_CONTEXT (decl)); else if (TREE_CODE (decl) == FIELD_DECL - || TREE_CODE (decl) == USING_DECL) + || TREE_CODE (decl) == USING_DECL + || TREE_CODE (decl) == CONST_DECL) { decl = DECL_CONTEXT (decl); if (TREE_CODE (decl) != FUNCTION_DECL)