From patchwork Thu Feb 27 15:42:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1245915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-520257-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=NJkqZE8U; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GICMsWfP; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Sxkr0kK8z9sTM for ; Fri, 28 Feb 2020 02:42:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=XcVJmhZBiCb0gR2v DUBGkeKAozZACRS8VqiqZnJJATR2Er2faQaDZFSk1r6J41IrSl4wGLg/wday3ds+ 9LzSStx5f+h67DIOx3hsWks/0IV4e5SbDHBgml3el7HWuM+brHMp2cfOFxgxS5Eh BIJm9Gn+Um4J43wn5lEKNnlz7wg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=MXgU4XccfBC8oLEZ3x9oJ0 MVJPM=; b=NJkqZE8UQZl2hobXoGZGTgm65zqr2ncclsqao2iIG/n9irMsc9luEZ fLrFZNOOppMXJx6VwjkwMgXauoVMgBP0tAz93rZiqk18+sTww5Ep2uSarCaIY5vM 0ttsn6G7/plHwn20OvyH4/2J5Wkw7G2t8ZW6UWqNFPOe2G2L030Ik= Received: (qmail 93719 invoked by alias); 27 Feb 2020 15:42:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 93709 invoked by uid 89); 27 Feb 2020 15:42:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Feb 2020 15:42:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582818150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qTcQTRS6PXKqazo4XJ97EHlRwoa6MgsqlX50jet1GKQ=; b=GICMsWfPZe0UDy30Vhmb0CQROK61r3yY9stkuF24LIDoY5B/+98CiQ/PTY0SUZUVJGqsuF lIRDHMH5rrVb3a+NXlWhRKi8tYjQckOio3loj4T+iN5LMC64+6s3mH10DlAlOrC2aK2jU8 pniDL82m9coKY8lHVgBDAdQ6oxlDCnc= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-423-k2zJi09RNheX0J8HQrNApg-1; Thu, 27 Feb 2020 10:42:28 -0500 Received: by mail-qk1-f200.google.com with SMTP id h6so4519621qkj.14 for ; Thu, 27 Feb 2020 07:42:28 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id d185sm3448939qkf.46.2020.02.27.07.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 07:42:26 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: -D_GLIBCXX_DEBUG fixes in the constrained algos tests Date: Thu, 27 Feb 2020 10:42:24 -0500 Message-Id: <20200227154224.1533311-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes This fixes some failures in the constrained algos tests when run in debug mode. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/copy/constrained.cc: Don't assume that the base() of an vector<>::iterator is a pointer. * testsuite/25_algorithms/copy_backward/constrained.cc: Likewise. * testsuite/25_algorithms/move/constrained.cc: Likewise. * testsuite/25_algorithms/move_backward/constrained.cc: Likewise. * testsuite/25_algorithms/inplace_merge/constrained.cc: Use foo.data() instead of &foo[0] when foo is a vector. * testsuite/25_algorithms/partial_sort/constrained.cc: Likewise. * testsuite/25_algorithms/partial_sort_copy/constrained.cc: Likewise. * testsuite/25_algorithms/shuffle/constrained.cc: Likewise. * testsuite/25_algorithms/sort/constrained.cc: Likewise. * testsuite/25_algorithms/stable_sort/constrained.cc: Likewise. --- .../testsuite/25_algorithms/copy/constrained.cc | 16 ++++++++-------- .../25_algorithms/copy_backward/constrained.cc | 16 ++++++++-------- .../25_algorithms/inplace_merge/constrained.cc | 2 +- .../testsuite/25_algorithms/move/constrained.cc | 16 ++++++++-------- .../25_algorithms/move_backward/constrained.cc | 16 ++++++++-------- .../25_algorithms/partial_sort/constrained.cc | 4 ++-- .../partial_sort_copy/constrained.cc | 8 ++++---- .../25_algorithms/shuffle/constrained.cc | 4 ++-- .../testsuite/25_algorithms/sort/constrained.cc | 4 ++-- .../25_algorithms/stable_sort/constrained.cc | 4 ++-- 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/copy/constrained.cc index 85f7d649608..aafe845db3a 100644 --- a/libstdc++-v3/testsuite/25_algorithms/copy/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/copy/constrained.cc @@ -70,8 +70,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::copy(x, ranges::begin(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data()+3 ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -81,8 +81,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::copy(x, ranges::begin(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data()+3 ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -93,8 +93,8 @@ test01() auto [in,out] = ranges::copy(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.end())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data() ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -105,8 +105,8 @@ test01() auto [in,out] = ranges::copy(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.end())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data() ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } } diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/constrained.cc index 900f78aaa73..9df2a2ff593 100644 --- a/libstdc++-v3/testsuite/25_algorithms/copy_backward/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/constrained.cc @@ -57,8 +57,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::copy_backward(x, ranges::end(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data() ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -68,8 +68,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::copy_backward(x, ranges::end(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data() ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -80,8 +80,8 @@ test01() auto [in,out] = ranges::copy_backward(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.begin())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data()+3 ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -92,8 +92,8 @@ test01() auto [in,out] = ranges::copy_backward(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.begin())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data()+3 ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } } diff --git a/libstdc++-v3/testsuite/25_algorithms/inplace_merge/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/inplace_merge/constrained.cc index 856056865d9..e6e16c85382 100644 --- a/libstdc++-v3/testsuite/25_algorithms/inplace_merge/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/inplace_merge/constrained.cc @@ -40,7 +40,7 @@ test01() v.insert(v.end(), x, x+j); ranges::sort(v); - test_range rz(&v[0], &v[0]+i+j); + test_range rz(v.data(), v.data()+i+j); auto result = ranges::inplace_merge(rz, next(ranges::begin(rz), i)); VERIFY( result == rz.end() ); diff --git a/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc index d205b3572a1..f15de548709 100644 --- a/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc @@ -99,8 +99,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::move(x, ranges::begin(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data()+3 ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -110,8 +110,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::move(x, ranges::begin(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data()+3 ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -122,8 +122,8 @@ test01() auto [in,out] = ranges::move(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.end())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data() ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -134,8 +134,8 @@ test01() auto [in,out] = ranges::move(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.end())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data() ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } } diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc index 3c4aa5dc70d..14f215578c7 100644 --- a/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/constrained.cc @@ -86,8 +86,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::move_backward(x, ranges::end(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data() ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -97,8 +97,8 @@ test01() std::vector y(3); const int z[3] = { 1, 2, 3 }; auto [in, out] = ranges::move_backward(x, ranges::end(y)); - VERIFY( in.base() == x.data()+3 ); - VERIFY( out.base() == y.data() ); + VERIFY( in == x.begin()+3 ); + VERIFY( out == y.begin() ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -109,8 +109,8 @@ test01() auto [in,out] = ranges::move_backward(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.begin())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data()+3 ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } @@ -121,8 +121,8 @@ test01() auto [in,out] = ranges::move_backward(make_reverse_iterator(x.end()), make_reverse_iterator(x.begin()), make_reverse_iterator(y.begin())); - VERIFY( in.base().base() == x.data()+3 ); - VERIFY( out.base().base() == y.data()+3 ); + VERIFY( in.base() == x.begin()+3 ); + VERIFY( out.base() == y.begin()+3 ); VERIFY( ranges::equal(y, z) && ranges::equal(x, z) ); } } diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort/constrained.cc index 430e3c0b61b..3b61fe73fd7 100644 --- a/libstdc++-v3/testsuite/25_algorithms/partial_sort/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/constrained.cc @@ -40,9 +40,9 @@ test01() std::iota(vref.begin(), vref.end(), 0); std::vector v1(vref), v2(vref); test_container c - = {&v1[0], &v1[0] + size}; + = {v1.data(), v1.data() + size}; test_range r - = {&v2[0], &v2[0] + size}; + = {v2.data(), v2.data() + size}; std::ranlux48_base g1(size), g2(size + 1); ranges::shuffle(c, g1); diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/constrained.cc index 6b586f885dd..519c41f2bde 100644 --- a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/constrained.cc @@ -49,15 +49,15 @@ test01() for (unsigned middle = 0; middle < 10; ++middle) { test_container c - = {&v1[0], &v1[0] + size}; + = {v1.data(), v1.data() + size}; test_range r - = {&v2[0], &v2[0] + size}; + = {v2.data(), v2.data() + size}; std::vector o1(middle), o2(middle); test_range w1 - = {&o1[0], &o1[0]+middle}; + = {o1.data(), o1.data()+middle}; test_range w2 - = {&o2[0], &o2[0]+middle}; + = {o2.data(), o2.data()+middle}; auto [in1, out1] = ranges::partial_sort_copy(c.begin(), c.end(), w1.begin(), w1.end(), diff --git a/libstdc++-v3/testsuite/25_algorithms/shuffle/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/shuffle/constrained.cc index b96343aecce..3f976005b37 100644 --- a/libstdc++-v3/testsuite/25_algorithms/shuffle/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/shuffle/constrained.cc @@ -42,9 +42,9 @@ test01() std::iota(vref.begin(), vref.end(), 0); std::vector v1(vref), v2(vref); test_container c - = {&v1[0], &v1[0] + size}; + = {v1.data(), v1.data() + size}; test_range r - = {&v2[0], &v2[0] + size}; + = {v2.data(), v2.data() + size}; std::ranlux48_base g1(size), g2(size + 1); VERIFY( ranges::shuffle(c, g1) == c.end() ); diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/sort/constrained.cc index d8227773ccb..b5a99b73cc3 100644 --- a/libstdc++-v3/testsuite/25_algorithms/sort/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/sort/constrained.cc @@ -40,9 +40,9 @@ test01() std::iota(vref.begin(), vref.end(), 0); std::vector v1(vref), v2(vref); test_container c - = {&v1[0], &v1[0] + size}; + = {v1.data(), v1.data() + size}; test_range r - = {&v2[0], &v2[0] + size}; + = {v2.data(), v2.data() + size}; std::ranlux48_base g1(size), g2(size + 1); ranges::shuffle(c, g1); diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_sort/constrained.cc b/libstdc++-v3/testsuite/25_algorithms/stable_sort/constrained.cc index 23a8c03b519..ef02ccaae45 100644 --- a/libstdc++-v3/testsuite/25_algorithms/stable_sort/constrained.cc +++ b/libstdc++-v3/testsuite/25_algorithms/stable_sort/constrained.cc @@ -44,9 +44,9 @@ test01() std::iota(vref.begin(), vref.end(), 0); std::vector v1(vref), v2(vref); test_container c - = {&v1[0], &v1[0] + size}; + = {v1.data(), v1.data() + size}; test_range r - = {&v2[0], &v2[0] + size}; + = {v2.data(), v2.data() + size}; std::ranlux48_base g1(size), g2(size + 1); ranges::shuffle(c, g1);