From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 1ECBF3851C0E for ; Mon, 28 Sep 2020 09:32:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1ECBF3851C0E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-167-BPrewRTUPoSDFkhdlKWYuA-1; Mon, 28 Sep 2020 05:31:59 -0400 X-MC-Unique: BPrewRTUPoSDFkhdlKWYuA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CB55425E2; Mon, 28 Sep 2020 09:31:58 +0000 (UTC) Received: from localhost (unknown [10.33.36.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 100395D9CA; Mon, 28 Sep 2020 09:31:56 +0000 (UTC) Date: Mon, 28 Sep 2020 10:31:55 +0100 From: Jonathan Wakely To: Patrick Palka Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH 1/4] libstdc++: Reduce the size of an unbounded iota_view Message-ID: <20200928093155.GA3946@redhat.com> References: <20200928044854.46674-1-ppalka@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200928044854.46674-1-ppalka@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-13.8 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, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2020 09:32:03 -0000 On 28/09/20 00:48 -0400, Patrick Palka via Libstdc++ wrote: >libstdc++-v3/ChangeLog: > > * include/std/ranges (iota_view::_M_bound): Give it > [[no_unique_address]]. > * testsuite/std/ranges/iota/iota_view.cc: Check that an > unbounded iota_view has minimal size. OK. > libstdc++-v3/include/std/ranges | 2 +- > libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc | 3 +++ > 2 files changed, 4 insertions(+), 1 deletion(-) > >diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges >index ed04fa0001d..964a2b616a6 100644 >--- a/libstdc++-v3/include/std/ranges >+++ b/libstdc++-v3/include/std/ranges >@@ -511,7 +511,7 @@ namespace ranges > }; > > _Winc _M_value = _Winc(); >- _Bound _M_bound = _Bound(); >+ [[no_unique_address]] _Bound _M_bound = _Bound(); > > public: > iota_view() = default; >diff --git a/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc b/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc >index 65d166fbd3b..8a33e10a093 100644 >--- a/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc >+++ b/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc >@@ -77,6 +77,9 @@ test04() > VERIFY( it == v.end() ); > } > >+// Verify we optimize away the 'bound' data member of an unbounded iota_view. >+static_assert(sizeof(std::ranges::iota_view) == 1); >+ > int > main() > { >-- >2.28.0.618.g9bc233ae1c >