public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
@ 2022-09-19 13:52 Patrick Palka
  2022-09-20 11:32 ` Nathan Sidwell
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Palka @ 2022-09-19 13:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: jason, nathan, Patrick Palka

It looks like some xtreme-header-* tests are failing after the libstdc++
change r13-2158-g02f6b405f0e9dc ultimately because we're neglecting
to stream PACK_EXPANSION_EXTRA_ARGS, which leads to false equivalences
of different partial instantiations of _TupleConstraints::__constructible.

Tested on x86_64-pc-linux-gnu, does this look OK for trunk?

	PR c++/106761

gcc/cp/ChangeLog:

	* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
	Stream PACK_EXPANSION_EXTRA_ARGS.
	(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.
---
 gcc/cp/module.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 1a1ff5be574..9a9ef4e3332 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -8922,6 +8922,7 @@ trees_out::type_node (tree type)
       if (streaming_p ())
 	u (PACK_EXPANSION_LOCAL_P (type));
       tree_node (PACK_EXPANSION_PARAMETER_PACKS (type));
+      tree_node (PACK_EXPANSION_EXTRA_ARGS (type));
       break;
 
     case TYPENAME_TYPE:
@@ -9455,12 +9456,14 @@ trees_in::tree_node (bool is_use)
 	    {
 	      bool local = u ();
 	      tree param_packs = tree_node ();
+	      tree extra_args = tree_node ();
 	      if (!get_overrun ())
 		{
 		  tree expn = cxx_make_type (TYPE_PACK_EXPANSION);
 		  SET_TYPE_STRUCTURAL_EQUALITY (expn);
 		  PACK_EXPANSION_PATTERN (expn) = res;
 		  PACK_EXPANSION_PARAMETER_PACKS (expn) = param_packs;
+		  PACK_EXPANSION_EXTRA_ARGS (expn) = extra_args;
 		  PACK_EXPANSION_LOCAL_P (expn) = local;
 		  res = expn;
 		}
-- 
2.38.0.rc0


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

* Re: [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
  2022-09-19 13:52 [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761] Patrick Palka
@ 2022-09-20 11:32 ` Nathan Sidwell
  2022-09-20 14:08   ` Patrick Palka
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2022-09-20 11:32 UTC (permalink / raw)
  To: Patrick Palka, gcc-patches; +Cc: jason

On 9/19/22 09:52, Patrick Palka wrote:
> It looks like some xtreme-header-* tests are failing after the libstdc++
> change r13-2158-g02f6b405f0e9dc ultimately because we're neglecting
> to stream PACK_EXPANSION_EXTRA_ARGS, which leads to false equivalences
> of different partial instantiations of _TupleConstraints::__constructible.
> 
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
> 
> 	PR c++/106761
> 
> gcc/cp/ChangeLog:
> 
> 	* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
> 	Stream PACK_EXPANSION_EXTRA_ARGS.
> 	(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.


Looks good, I wonder why I missed that.  (I guess extracting a testcase 
out of the headers was too tricky?)

nathan
> ---
>   gcc/cp/module.cc | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
> index 1a1ff5be574..9a9ef4e3332 100644
> --- a/gcc/cp/module.cc
> +++ b/gcc/cp/module.cc
> @@ -8922,6 +8922,7 @@ trees_out::type_node (tree type)
>         if (streaming_p ())
>   	u (PACK_EXPANSION_LOCAL_P (type));
>         tree_node (PACK_EXPANSION_PARAMETER_PACKS (type));
> +      tree_node (PACK_EXPANSION_EXTRA_ARGS (type));
>         break;
>   
>       case TYPENAME_TYPE:
> @@ -9455,12 +9456,14 @@ trees_in::tree_node (bool is_use)
>   	    {
>   	      bool local = u ();
>   	      tree param_packs = tree_node ();
> +	      tree extra_args = tree_node ();
>   	      if (!get_overrun ())
>   		{
>   		  tree expn = cxx_make_type (TYPE_PACK_EXPANSION);
>   		  SET_TYPE_STRUCTURAL_EQUALITY (expn);
>   		  PACK_EXPANSION_PATTERN (expn) = res;
>   		  PACK_EXPANSION_PARAMETER_PACKS (expn) = param_packs;
> +		  PACK_EXPANSION_EXTRA_ARGS (expn) = extra_args;
>   		  PACK_EXPANSION_LOCAL_P (expn) = local;
>   		  res = expn;
>   		}

-- 
Nathan Sidwell


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

* Re: [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
  2022-09-20 11:32 ` Nathan Sidwell
@ 2022-09-20 14:08   ` Patrick Palka
  2022-09-20 14:14     ` Nathan Sidwell
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Palka @ 2022-09-20 14:08 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: Patrick Palka, gcc-patches, jason

On Tue, 20 Sep 2022, Nathan Sidwell wrote:

> On 9/19/22 09:52, Patrick Palka wrote:
> > It looks like some xtreme-header-* tests are failing after the libstdc++
> > change r13-2158-g02f6b405f0e9dc ultimately because we're neglecting
> > to stream PACK_EXPANSION_EXTRA_ARGS, which leads to false equivalences
> > of different partial instantiations of _TupleConstraints::__constructible.
> > 
> > Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
> > 
> > 	PR c++/106761
> > 
> > gcc/cp/ChangeLog:
> > 
> > 	* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
> > 	Stream PACK_EXPANSION_EXTRA_ARGS.
> > 	(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.
> 
> 
> Looks good, I wonder why I missed that.  (I guess extracting a testcase out of
> the headers was too tricky?)

Many thanks.  I managed to produce a small testcase which mirrors the
format of the xtreme-header-2* testcase.  Does the following look OK?

-- >8 --

	PR c++/106761

gcc/cp/ChangeLog:

	* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
	Stream PACK_EXPANSION_EXTRA_ARGS.
	(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/pr106761.h: New test.
	* g++.dg/modules/pr106761_a.H: New test.
	* g++.dg/modules/pr106761_b.C: New test.
---
 gcc/cp/module.cc                          |  3 +++
 gcc/testsuite/g++.dg/modules/pr106761.h   | 22 ++++++++++++++++++++++
 gcc/testsuite/g++.dg/modules/pr106761_a.H |  5 +++++
 gcc/testsuite/g++.dg/modules/pr106761_b.C |  7 +++++++
 4 files changed, 37 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/modules/pr106761.h
 create mode 100644 gcc/testsuite/g++.dg/modules/pr106761_a.H
 create mode 100644 gcc/testsuite/g++.dg/modules/pr106761_b.C

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 1a1ff5be574..9a9ef4e3332 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -8922,6 +8922,7 @@ trees_out::type_node (tree type)
       if (streaming_p ())
 	u (PACK_EXPANSION_LOCAL_P (type));
       tree_node (PACK_EXPANSION_PARAMETER_PACKS (type));
+      tree_node (PACK_EXPANSION_EXTRA_ARGS (type));
       break;
 
     case TYPENAME_TYPE:
@@ -9455,12 +9456,14 @@ trees_in::tree_node (bool is_use)
 	    {
 	      bool local = u ();
 	      tree param_packs = tree_node ();
+	      tree extra_args = tree_node ();
 	      if (!get_overrun ())
 		{
 		  tree expn = cxx_make_type (TYPE_PACK_EXPANSION);
 		  SET_TYPE_STRUCTURAL_EQUALITY (expn);
 		  PACK_EXPANSION_PATTERN (expn) = res;
 		  PACK_EXPANSION_PARAMETER_PACKS (expn) = param_packs;
+		  PACK_EXPANSION_EXTRA_ARGS (expn) = extra_args;
 		  PACK_EXPANSION_LOCAL_P (expn) = local;
 		  res = expn;
 		}
diff --git a/gcc/testsuite/g++.dg/modules/pr106761.h b/gcc/testsuite/g++.dg/modules/pr106761.h
new file mode 100644
index 00000000000..9f22a22a45d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr106761.h
@@ -0,0 +1,22 @@
+// PR c++/106761
+
+template<class...>
+struct __and_;
+
+template<class, class>
+struct is_convertible;
+
+template<class... Ts>
+struct _TupleConstraints {
+  template<class... Us>
+  using __constructible = __and_<is_convertible<Ts, Us>...>;
+};
+
+template<class... Ts>
+struct tuple {
+  template<class... Us>
+  using __constructible
+    = typename _TupleConstraints<Ts...>::template __constructible<Us...>;
+};
+
+tuple<int, int> t;
diff --git a/gcc/testsuite/g++.dg/modules/pr106761_a.H b/gcc/testsuite/g++.dg/modules/pr106761_a.H
new file mode 100644
index 00000000000..8ad116412af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr106761_a.H
@@ -0,0 +1,5 @@
+// PR c++/106761
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "pr106761.h"
diff --git a/gcc/testsuite/g++.dg/modules/pr106761_b.C b/gcc/testsuite/g++.dg/modules/pr106761_b.C
new file mode 100644
index 00000000000..336cb12757e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr106761_b.C
@@ -0,0 +1,7 @@
+// PR c++/106761
+// { dg-additional-options -fmodules-ts }
+
+#include "pr106761.h"
+import "pr106761_a.H";
+
+tuple<int, int> u = t;
-- 
2.38.0.rc0.52.gdda7228a83


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

* Re: [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
  2022-09-20 14:08   ` Patrick Palka
@ 2022-09-20 14:14     ` Nathan Sidwell
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2022-09-20 14:14 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches, jason

On 9/20/22 10:08, Patrick Palka wrote:
> On Tue, 20 Sep 2022, Nathan Sidwell wrote:
> 
>> On 9/19/22 09:52, Patrick Palka wrote:
>>> It looks like some xtreme-header-* tests are failing after the libstdc++
>>> change r13-2158-g02f6b405f0e9dc ultimately because we're neglecting
>>> to stream PACK_EXPANSION_EXTRA_ARGS, which leads to false equivalences
>>> of different partial instantiations of _TupleConstraints::__constructible.
>>>
>>> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
>>>
>>> 	PR c++/106761
>>>
>>> gcc/cp/ChangeLog:
>>>
>>> 	* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
>>> 	Stream PACK_EXPANSION_EXTRA_ARGS.
>>> 	(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.
>>
>>
>> Looks good, I wonder why I missed that.  (I guess extracting a testcase out of
>> the headers was too tricky?)
> 
> Many thanks.  I managed to produce a small testcase which mirrors the
> format of the xtreme-header-2* testcase.  Does the following look OK?

yup, thanks for extracting that!

nathan
> 
> -- >8 --
> 
> 	PR c++/106761
> 
> gcc/cp/ChangeLog:
> 
> 	* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
> 	Stream PACK_EXPANSION_EXTRA_ARGS.
> 	(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/modules/pr106761.h: New test.
> 	* g++.dg/modules/pr106761_a.H: New test.
> 	* g++.dg/modules/pr106761_b.C: New test.
> ---
>   gcc/cp/module.cc                          |  3 +++
>   gcc/testsuite/g++.dg/modules/pr106761.h   | 22 ++++++++++++++++++++++
>   gcc/testsuite/g++.dg/modules/pr106761_a.H |  5 +++++
>   gcc/testsuite/g++.dg/modules/pr106761_b.C |  7 +++++++
>   4 files changed, 37 insertions(+)
>   create mode 100644 gcc/testsuite/g++.dg/modules/pr106761.h
>   create mode 100644 gcc/testsuite/g++.dg/modules/pr106761_a.H
>   create mode 100644 gcc/testsuite/g++.dg/modules/pr106761_b.C
> 
> diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
> index 1a1ff5be574..9a9ef4e3332 100644
> --- a/gcc/cp/module.cc
> +++ b/gcc/cp/module.cc
> @@ -8922,6 +8922,7 @@ trees_out::type_node (tree type)
>         if (streaming_p ())
>   	u (PACK_EXPANSION_LOCAL_P (type));
>         tree_node (PACK_EXPANSION_PARAMETER_PACKS (type));
> +      tree_node (PACK_EXPANSION_EXTRA_ARGS (type));
>         break;
>   
>       case TYPENAME_TYPE:
> @@ -9455,12 +9456,14 @@ trees_in::tree_node (bool is_use)
>   	    {
>   	      bool local = u ();
>   	      tree param_packs = tree_node ();
> +	      tree extra_args = tree_node ();
>   	      if (!get_overrun ())
>   		{
>   		  tree expn = cxx_make_type (TYPE_PACK_EXPANSION);
>   		  SET_TYPE_STRUCTURAL_EQUALITY (expn);
>   		  PACK_EXPANSION_PATTERN (expn) = res;
>   		  PACK_EXPANSION_PARAMETER_PACKS (expn) = param_packs;
> +		  PACK_EXPANSION_EXTRA_ARGS (expn) = extra_args;
>   		  PACK_EXPANSION_LOCAL_P (expn) = local;
>   		  res = expn;
>   		}
> diff --git a/gcc/testsuite/g++.dg/modules/pr106761.h b/gcc/testsuite/g++.dg/modules/pr106761.h
> new file mode 100644
> index 00000000000..9f22a22a45d
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/modules/pr106761.h
> @@ -0,0 +1,22 @@
> +// PR c++/106761
> +
> +template<class...>
> +struct __and_;
> +
> +template<class, class>
> +struct is_convertible;
> +
> +template<class... Ts>
> +struct _TupleConstraints {
> +  template<class... Us>
> +  using __constructible = __and_<is_convertible<Ts, Us>...>;
> +};
> +
> +template<class... Ts>
> +struct tuple {
> +  template<class... Us>
> +  using __constructible
> +    = typename _TupleConstraints<Ts...>::template __constructible<Us...>;
> +};
> +
> +tuple<int, int> t;
> diff --git a/gcc/testsuite/g++.dg/modules/pr106761_a.H b/gcc/testsuite/g++.dg/modules/pr106761_a.H
> new file mode 100644
> index 00000000000..8ad116412af
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/modules/pr106761_a.H
> @@ -0,0 +1,5 @@
> +// PR c++/106761
> +// { dg-additional-options -fmodule-header }
> +
> +// { dg-module-cmi {} }
> +#include "pr106761.h"
> diff --git a/gcc/testsuite/g++.dg/modules/pr106761_b.C b/gcc/testsuite/g++.dg/modules/pr106761_b.C
> new file mode 100644
> index 00000000000..336cb12757e
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/modules/pr106761_b.C
> @@ -0,0 +1,7 @@
> +// PR c++/106761
> +// { dg-additional-options -fmodules-ts }
> +
> +#include "pr106761.h"
> +import "pr106761_a.H";
> +
> +tuple<int, int> u = t;

-- 
Nathan Sidwell


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

end of thread, other threads:[~2022-09-20 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 13:52 [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761] Patrick Palka
2022-09-20 11:32 ` Nathan Sidwell
2022-09-20 14:08   ` Patrick Palka
2022-09-20 14:14     ` 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).