From patchwork Sun Nov 12 01:59:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 1862798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=H9ZZin0e; 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 4SSbPQ5wLvz1yRV for ; Sun, 12 Nov 2023 13:00:41 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 17D05385703F for ; Sun, 12 Nov 2023 02:00:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id EE2833858C5F for ; Sun, 12 Nov 2023 01:59:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE2833858C5F 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 EE2833858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699754386; cv=none; b=snyE3jHGvz3jqOD6GI6HamIltK6B/kFXJZqD+15LChqHCL5ay+VFGyQonieknM0aHMAMkvEMWk6QweZH0M5J30/pDAv+yxgrzD/b60o1h5urJxzZ170p4Ju191z+lhaBdSd2tugf5RC64GAZNQfvmfnVRlL8TM9IdKe5PgCfCMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699754386; c=relaxed/simple; bh=PZqPzEqPFPpYZas1MpJ8u2i313/lBtVIecb8pW18n7Y=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=JEt2qPiNwD7kzH/RE2gkVGL2A6a1J0p8W5J6O8Jzs7nxaxV/mIdaZ/rQy13Cxc8z5GNlYXN9Le9GvC5Yksj7WZEdE5yUkH9YFt7ndXeo1WuJYZR1hpJGrCU0/U3s3iXSDGNGnowyxsEzqd6RhQpnF+bYQQ15CFgrku//EJBe+OU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6ce291b5df9so2063468a34.2 for ; Sat, 11 Nov 2023 17:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699754381; x=1700359181; 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=5R0dE2AObgx3trUBjWd42glgbvk7Nmm9ySS0e5P3IPo=; b=H9ZZin0eYCFtzw1hwDlzJkqFAJh4giTWr+5AiK7XoeuQvls6hfsqHb1FMGJq3jtQTF sQkRp6uguZzLGdagek/zKP5+Qxy4eEltbIBLHm3/b/WIOvhrA0Xl8xfHE6vonx7ODfWB drB5IzesxDWCG23k642jdXt5zDFyJbPd8dSM+iEvygnTeMqzM5BY4jmLVAWChzTctH/H oq6OM6853GbtSYjGl6wUa3gwnKcFBtrExBjoKsbL8WbffqDt02vbwUQQXuJP9oFMqqBf HYN+TleUL1Qa3OuoCfIcssE0YVYS/dH2R0Ovps2cSrJEEU7w73me9wLjWO5ezPEYT39E WgEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699754381; x=1700359181; 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=5R0dE2AObgx3trUBjWd42glgbvk7Nmm9ySS0e5P3IPo=; b=sk0W+EzSQ/vMWgEIihMYuTYgfVH0Qy0gHefx9cpVJvqgpJ2V4NeAabMyKOlTa1dzrd hv4lwqxNHYcx83UoRK3TeV/WBYmj9tp97AN2YVtkPPo6lzNWme7O+n1pLtjIG/Utbgzh /IcWZewGg08eZyMJ7rLoVISj539sgMSnwQbRKxzjA+jQPQb9PIVuebhWRiEGvxuYErmf 7RDdnMScGRFHuztXTzZrJ76F7gUTI8pyrr3oU+ITzMDcaH6lGHuY0kh4Zt0iLGh+8U3f HvC8R+ir/eCkcBqc6KSpET3fp/DUjkr0TrXIfv0/EUYzG9mV55cYG1uygAFXsgL4dog/ nDhw== X-Gm-Message-State: AOJu0Yy9zR2JpXHFr6Brzeef5MVxCI4DvRSWnR8FKhmoBSlDGQG/osv3 L4jfSmGbpQogae8wz+0en2NT5a/g7C8= X-Google-Smtp-Source: AGHT+IF5+5MfEvyFrdC5uoDHReBUewbsVjUtt4XN29dehkd4/XRsLpRQuTA+1obQ1rPn7W3dDyjw9g== X-Received: by 2002:a05:6808:11c7:b0:3b5:84b0:6be6 with SMTP id p7-20020a05680811c700b003b584b06be6mr5377463oiv.47.1699754380827; Sat, 11 Nov 2023 17:59:40 -0800 (PST) Received: from Thaum. (124-150-88-161.tpgi.com.au. [124.150.88.161]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c10600b001c8a0879805sm1858471pli.206.2023.11.11.17.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Nov 2023 17:59:40 -0800 (PST) Message-ID: <6550318c.170a0220.caf0c.3fe5@mx.google.com> X-Google-Original-Message-ID: Date: Sun, 12 Nov 2023 12:59:36 +1100 From: Nathaniel Shead To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [PATCH] c++/modules: seed namespaces for bindings [PR106363] MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-11.1 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, 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. I don't have write access. -- >8 -- Currently the first depset for an EK_BINDING is not seeded. This breaks the attached testcase as then the namespace is not considered referenced yet during streaming, but we've already finished importing. There doesn't seem to be any particular reason I could find for skipping the first depset for bindings, and removing the condition doesn't appear to cause any test failures, so this patch removes that check. PR c++/106363 gcc/cp/ChangeLog: * module.cc (module_state::write_cluster): Don't skip first depset for bindings. gcc/testsuite/ChangeLog: * g++.dg/modules/pr106363_a.C: New test. * g++.dg/modules/pr106363_b.C: New test. Signed-off-by: Nathaniel Shead --- gcc/cp/module.cc | 4 +--- gcc/testsuite/g++.dg/modules/pr106363_a.C | 9 +++++++++ gcc/testsuite/g++.dg/modules/pr106363_b.C | 10 ++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/modules/pr106363_a.C create mode 100644 gcc/testsuite/g++.dg/modules/pr106363_b.C diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index c1c8c226bc1..411a3b9411c 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -14741,9 +14741,7 @@ module_state::write_cluster (elf_out *to, depset *scc[], unsigned size, for (unsigned ix = 0; ix != size; ix++) { depset *b = scc[ix]; - for (unsigned jx = (b->get_entity_kind () == depset::EK_BINDING - || b->is_special ()) ? 1 : 0; - jx != b->deps.length (); jx++) + for (unsigned jx = b->is_special (); jx != b->deps.length (); jx++) { depset *dep = b->deps[jx]; diff --git a/gcc/testsuite/g++.dg/modules/pr106363_a.C b/gcc/testsuite/g++.dg/modules/pr106363_a.C new file mode 100644 index 00000000000..c18d2eef1c8 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr106363_a.C @@ -0,0 +1,9 @@ +// PR c++/106363 +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi pr106363.a } + +export module pr106363.a; + +namespace ns { + export int x; +} diff --git a/gcc/testsuite/g++.dg/modules/pr106363_b.C b/gcc/testsuite/g++.dg/modules/pr106363_b.C new file mode 100644 index 00000000000..0508c0d6193 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr106363_b.C @@ -0,0 +1,10 @@ +// PR c++/106363 +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi pr106363.b } + +export module pr106363.b; +import pr106363.a; + +namespace ns { + export using ns::x; +}