public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++/modules: seed namespaces for bindings [PR106363]
@ 2023-11-12  1:59 Nathaniel Shead
  2023-12-16 10:31 ` Nathaniel Shead
  2024-01-06 22:23 ` Nathan Sidwell
  0 siblings, 2 replies; 4+ messages in thread
From: Nathaniel Shead @ 2023-11-12  1:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill, Nathan Sidwell

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 <nathanieloshead@gmail.com>
---
 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;
+}
-- 
2.42.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] c++/modules: seed namespaces for bindings [PR106363]
  2023-11-12  1:59 [PATCH] c++/modules: seed namespaces for bindings [PR106363] Nathaniel Shead
@ 2023-12-16 10:31 ` Nathaniel Shead
  2023-12-16 23:19   ` Nathan Sidwell
  2024-01-06 22:23 ` Nathan Sidwell
  1 sibling, 1 reply; 4+ messages in thread
From: Nathaniel Shead @ 2023-12-16 10:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill, Nathan Sidwell

Ping for https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636159.html

On Sun, Nov 12, 2023 at 12:59:36PM +1100, Nathaniel Shead wrote:
> 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 <nathanieloshead@gmail.com>
> ---
>  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;
> +}
> -- 
> 2.42.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] c++/modules: seed namespaces for bindings [PR106363]
  2023-12-16 10:31 ` Nathaniel Shead
@ 2023-12-16 23:19   ` Nathan Sidwell
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2023-12-16 23:19 UTC (permalink / raw)
  To: Nathaniel Shead, gcc-patches; +Cc: Jason Merrill

On 12/16/23 05:31, Nathaniel Shead wrote:
> Ping for https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636159.html


ok
> 
> On Sun, Nov 12, 2023 at 12:59:36PM +1100, Nathaniel Shead wrote:
>> 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 <nathanieloshead@gmail.com>
>> ---
>>   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;
>> +}
>> -- 
>> 2.42.0
>>

-- 
Nathan Sidwell


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] c++/modules: seed namespaces for bindings [PR106363]
  2023-11-12  1:59 [PATCH] c++/modules: seed namespaces for bindings [PR106363] Nathaniel Shead
  2023-12-16 10:31 ` Nathaniel Shead
@ 2024-01-06 22:23 ` Nathan Sidwell
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2024-01-06 22:23 UTC (permalink / raw)
  To: Nathaniel Shead, gcc-patches; +Cc: Jason Merrill

Ok,
I think I js=ust thought this unnecessary.


On 11/11/23 20:59, Nathaniel Shead wrote:
> 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 <nathanieloshead@gmail.com>
> ---
>   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;
> +}

-- 
Nathan Sidwell


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-06 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12  1:59 [PATCH] c++/modules: seed namespaces for bindings [PR106363] Nathaniel Shead
2023-12-16 10:31 ` Nathaniel Shead
2023-12-16 23:19   ` Nathan Sidwell
2024-01-06 22:23 ` Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).