Message ID | 20220919135229.86545-1-ppalka@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6956A3858413 for <patchwork@sourceware.org>; Mon, 19 Sep 2022 13:53:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6956A3858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663595583; bh=UPGQ0c4GVb1hYvj3+jU+w7sd4nhQTApOSJcIP1mdF74=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=CHxgU7GiIUfxnYmSMIqCHGdiNty6Cl2+rYCWb15YChh0bNCV8ZWWfeVB7t7f/NmAl dR/QF6aq0UCE4TnfG9G2E26SErDPdciAFEdjJgpA3Wy+LRP/GxzLa+Itpn8PUgGFIM TVKy5D+qphpht8FXCq8Aj3LnAfw5pQykzXPFSM74= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 200703858D28 for <gcc-patches@gcc.gnu.org>; Mon, 19 Sep 2022 13:52:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 200703858D28 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-457-mA0ILnN6P22EErj30k8grA-1; Mon, 19 Sep 2022 09:52:33 -0400 X-MC-Unique: mA0ILnN6P22EErj30k8grA-1 Received: by mail-qk1-f197.google.com with SMTP id n15-20020a05620a294f00b006b5768a0ed0so24136392qkp.7 for <gcc-patches@gcc.gnu.org>; Mon, 19 Sep 2022 06:52:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=UPGQ0c4GVb1hYvj3+jU+w7sd4nhQTApOSJcIP1mdF74=; b=ZhZqmKdfIRJlKeFQ+xxgJQBUVv/PfgNTUEwoAM83G71RA1uJvVlgLDovbg1qHzq7Bd Ro3xnJTCxKveV5J84Z2N84hDIiu1/bxujvdQ7bD3ijXfsCZLPVi2vfq8dwyo7OOf7wSv 3CEYif3KGxA87NqAvmyFtBpHB3vckwwAVdmJ7e18h9nu0g0U/eXIrQEoXdh7mP/8WnPt F7HVWJita3Ojsrqd/YIkj0BGCH+MFZ3UwGvpM3GzZ9DkTJRrnpo6C5DqB000MxXYDg0h qSio4Grc3ael8JWIKueJCCx3DVXz21J7Gf2MKCDIwEdhQaLwTGG8eROE5mQ5Xatic51t L6nQ== X-Gm-Message-State: ACrzQf3AsznXZfl+HyxvSeqkfsnhDQFPqZXmVLAVadQ0vjlSbav8XmiW Ga24eFjhNwE94cqEGyjf1qqluQeZLrNNI8Q5eHCKDde5pg8NpQNOrSCs43kKX0zH8IQ9EkuLv3o AlLbQQs35Mn/9uM0IKPWHhED/vNdeQy3g6fYSDQZTI7dgGiNZOK0tI4ioP5srAgi+8F8= X-Received: by 2002:a05:6214:e6f:b0:4ad:d5a:f09b with SMTP id jz15-20020a0562140e6f00b004ad0d5af09bmr13919302qvb.34.1663595552713; Mon, 19 Sep 2022 06:52:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KEDjoW6lpsXDYfJ1QQjmjcVDeO3B8syHePbNgf8NAVTIhJJ/3vfkAykkwf3YuY/gSOly2Pg== X-Received: by 2002:a05:6214:e6f:b0:4ad:d5a:f09b with SMTP id jz15-20020a0562140e6f00b004ad0d5af09bmr13919268qvb.34.1663595552428; Mon, 19 Sep 2022 06:52:32 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id n7-20020a05620a294700b006b949afa980sm13307846qkp.56.2022.09.19.06.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 06:52:31 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761] Date: Mon, 19 Sep 2022 09:52:29 -0400 Message-Id: <20220919135229.86545-1-ppalka@redhat.com> X-Mailer: git-send-email 2.38.0.rc0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-14.4 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_LOW, SPF_HELO_NONE, SPF_NONE, TXREP 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.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Patrick Palka via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Patrick Palka <ppalka@redhat.com> Cc: nathan@acm.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
|
|
Commit Message
Patrick Palka
Sept. 19, 2022, 1:52 p.m. UTC
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(+)
Comments
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; > }
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;
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;
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; }