From patchwork Fri Oct 4 13:09:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1992744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fFbLatIF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKppj3MtXz1xt7 for ; Fri, 4 Oct 2024 23:11:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 24F0B386F467 for ; Fri, 4 Oct 2024 13:11:38 +0000 (GMT) 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 ESMTP id 089A2385E011 for ; Fri, 4 Oct 2024 13:11:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 089A2385E011 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 089A2385E011 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728047474; cv=none; b=SFLBNt/YGl1oVZdmt8+USEAcFfpxCiRfz90t/epsabxMQ0ihU4SDBTZr2ZJPTSrJkwQMdTYnnU1XtSvK1LXxxexhohHzd5xNZh5oMx9/ny0JmeDbqnrgVW9wh1dO3eJ83kxUSTRCoMcp2Ec1DiMI175kEUZDEz5dGh77oYkzTPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728047474; c=relaxed/simple; bh=WHFui4wVE3h4b9IxPJF/0+wKb8IdoSCYPfcLR1QTu/w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=K2HIn3VUjNiO77m3wuFyNBMxJuHS85cGhW5nMXEZ3cItA8OCejyaYiiPQ4RcmTXxxGpMHfzoS56wUZjgp7/Mr0CbB2SkilaynrbWhh4LitkyrWbA/dp58AquNvNAzycYBfykR7PMBYGphsPxMsbdRMqfDDfcJs5S+xXf0r+CX3Y= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728047471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2jtQQjjuf60Bd6oZRuU8lrx6lR1Q1E9Q2j7DQpVWvLw=; b=fFbLatIFsQj81nFQsFIwIPmxeo2r5owoYnelr5cY8t3RLQEIHOcBI24jWjHGbtc5GWgaxn /jmZ8HooCkursD4+yOP48hFMvyrTYAX0lOqeGCZJM/LZr2hpaee027aP3/ufgQlV2iMIVp EIRb9Pjng1Tksx6uPw/3SMPlwPdYd4k= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-VXaK-spnPICo8cZaahqTxQ-1; Fri, 04 Oct 2024 09:11:09 -0400 X-MC-Unique: VXaK-spnPICo8cZaahqTxQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53D711955D42; Fri, 4 Oct 2024 13:11:08 +0000 (UTC) Received: from localhost (unknown [10.42.28.136]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B8F1A1955EA6; Fri, 4 Oct 2024 13:11:06 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix some Parallel Mode testsuite failures Date: Fri, 4 Oct 2024 14:09:00 +0100 Message-ID: <20241004131104.3917161-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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_H3, RCVD_IN_MSPIKE_WL, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org There are more failures that I haven't found yet, because running make check-parallel seems to take several days (because I'm running with GLIBCXX_TESTSUITE_STDS=98,11,14,17,20,23,26). We can fix the rest later. Pushed to trunk. -- >8 -- Some of these are due to no longer using #pragma GCC system_header in libstdc++ headers, some have been failing for longer and weren't noticed. libstdc++-v3/ChangeLog: * include/parallel/algobase.h (search): Use sequential algorithm for constant evaluation. * include/parallel/algorithmfwd.h (search): Add _GLIBCXX20_CONSTEXPR. * include/parallel/multiway_merge.h: Remove stray semi-colon. * include/parallel/multiseq_selection.h: Add diagnostic pragmas for -Wlong-long warning. * include/parallel/quicksort.h: Likewise. * include/parallel/random_number.h: Likewise. * include/parallel/settings.h: Likewise. * include/parallel/workstealing.h: Replace ++ and -- on volatile variables. * testsuite/17_intro/names.cc: Skip names defined by . * testsuite/20_util/pair/dangling_ref.cc: Skip test if Parallel Mode is enabled. * testsuite/20_util/tuple/dangling_ref.cc: Likewise. --- libstdc++-v3/include/parallel/algobase.h | 6 ++++++ libstdc++-v3/include/parallel/algorithmfwd.h | 1 + libstdc++-v3/include/parallel/multiseq_selection.h | 3 +++ libstdc++-v3/include/parallel/multiway_merge.h | 2 +- libstdc++-v3/include/parallel/quicksort.h | 3 +++ libstdc++-v3/include/parallel/random_number.h | 5 +++++ libstdc++-v3/include/parallel/settings.h | 5 +++++ libstdc++-v3/include/parallel/workstealing.h | 4 ++-- libstdc++-v3/testsuite/17_intro/names.cc | 6 ++++-- libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc | 2 +- libstdc++-v3/testsuite/20_util/tuple/dangling_ref.cc | 2 +- 11 files changed, 32 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/include/parallel/algobase.h b/libstdc++-v3/include/parallel/algobase.h index 67362f4ecaa..b46ed610661 100644 --- a/libstdc++-v3/include/parallel/algobase.h +++ b/libstdc++-v3/include/parallel/algobase.h @@ -515,11 +515,17 @@ namespace __parallel // Public interface template + _GLIBCXX20_CONSTEXPR inline _FIterator1 search(_FIterator1 __begin1, _FIterator1 __end1, _FIterator2 __begin2, _FIterator2 __end2, _BinaryPredicate __pred) { +#if __cplusplus > 201703L + if (std::is_constant_evaluated()) + return _GLIBCXX_STD_A::search(__begin1, __end1, __begin2, __end2, + std::move(__pred)); +#endif return __search_switch(__begin1, __end1, __begin2, __end2, __pred, std::__iterator_category(__begin1), std::__iterator_category(__begin2)); diff --git a/libstdc++-v3/include/parallel/algorithmfwd.h b/libstdc++-v3/include/parallel/algorithmfwd.h index 476072b860a..7c9843ab161 100644 --- a/libstdc++-v3/include/parallel/algorithmfwd.h +++ b/libstdc++-v3/include/parallel/algorithmfwd.h @@ -353,6 +353,7 @@ namespace __parallel __gnu_parallel::sequential_tag); template + _GLIBCXX20_CONSTEXPR _FIter1 search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate); diff --git a/libstdc++-v3/include/parallel/multiseq_selection.h b/libstdc++-v3/include/parallel/multiseq_selection.h index 22bd97e6432..53264fd156b 100644 --- a/libstdc++-v3/include/parallel/multiseq_selection.h +++ b/libstdc++-v3/include/parallel/multiseq_selection.h @@ -189,9 +189,12 @@ namespace __gnu_parallel __r = __rd_log2(__nmax) + 1; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" // LL literal // Pad all lists to this length, at least as long as any ns[__i], // equality iff __nmax = 2^__k - 1. __l = (1ULL << __r) - 1; +#pragma GCC diagnostic pop for (_SeqNumber __i = 0; __i < __m; __i++) { diff --git a/libstdc++-v3/include/parallel/multiway_merge.h b/libstdc++-v3/include/parallel/multiway_merge.h index e4bd0042282..d894e636a3e 100644 --- a/libstdc++-v3/include/parallel/multiway_merge.h +++ b/libstdc++-v3/include/parallel/multiway_merge.h @@ -2067,6 +2067,6 @@ namespace __gnu_parallel (__seqs_begin, __seqs_end, __target, __length, __comp, exact_tag(__tag.__get_num_threads())); } -}; // namespace __gnu_parallel +} // namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H */ diff --git a/libstdc++-v3/include/parallel/quicksort.h b/libstdc++-v3/include/parallel/quicksort.h index a678b6d4690..c728cd91c24 100644 --- a/libstdc++-v3/include/parallel/quicksort.h +++ b/libstdc++-v3/include/parallel/quicksort.h @@ -66,12 +66,15 @@ namespace __gnu_parallel _ValueType* __samples = static_cast<_ValueType*> (::operator new(__num_samples * sizeof(_ValueType))); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" // LL literal for (_DifferenceType __s = 0; __s < __num_samples; ++__s) { const unsigned long long __index = static_cast (__s) * __n / __num_samples; ::new(&(__samples[__s])) _ValueType(__begin[__index]); } +#pragma GCC diagnostic pop __gnu_sequential::sort(__samples, __samples + __num_samples, __comp); diff --git a/libstdc++-v3/include/parallel/random_number.h b/libstdc++-v3/include/parallel/random_number.h index 8f8d9cd0651..0357fab79c8 100644 --- a/libstdc++-v3/include/parallel/random_number.h +++ b/libstdc++-v3/include/parallel/random_number.h @@ -38,6 +38,9 @@ namespace __gnu_parallel { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" // LL literal + /** @brief Random number generator, based on the Mersenne twister. */ class _RandomNumber { @@ -120,6 +123,8 @@ namespace __gnu_parallel } }; +#pragma GCC diagnostic pop + } // namespace __gnu_parallel #endif /* _GLIBCXX_PARALLEL_RANDOM_NUMBER_H */ diff --git a/libstdc++-v3/include/parallel/settings.h b/libstdc++-v3/include/parallel/settings.h index 1fbe458d583..aac41649470 100644 --- a/libstdc++-v3/include/parallel/settings.h +++ b/libstdc++-v3/include/parallel/settings.h @@ -84,6 +84,9 @@ #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" // LL literal + /** * @brief Determine at compile(?)-time if the parallel variant of an * algorithm should be called. @@ -339,4 +342,6 @@ namespace __gnu_parallel }; } +#pragma GCC diagnostic pop + #endif /* _GLIBCXX_PARALLEL_SETTINGS_H */ diff --git a/libstdc++-v3/include/parallel/workstealing.h b/libstdc++-v3/include/parallel/workstealing.h index f24d542d58b..cd338fac455 100644 --- a/libstdc++-v3/include/parallel/workstealing.h +++ b/libstdc++-v3/include/parallel/workstealing.h @@ -191,8 +191,8 @@ namespace __gnu_parallel // Cannot use volatile variable directly. _DifferenceType __my_first = __my_job._M_first; __result = __f(__op, __begin + __my_first); - ++__my_job._M_first; - --__my_job._M_load; + __my_job._M_first += 1; + __my_job._M_load -= 1; } _RAIter __current; diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index 9b0ffcb50b2..6b9a3639aad 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -84,15 +84,17 @@ #define n ( #endif #define o ( -#if __cplusplus >= 201103L +#if __cplusplus >= 201103L || defined(_GLIBCXX_PARALLEL) // defines member functions called p() +// (and defines them too, which is included by Parallel Mode). #else #define p ( #endif #define q ( #define r ( -#if __cplusplus >= 201103L +#if __cplusplus >= 201103L || defined(_GLIBCXX_PARALLEL) // defines member functions called s() and t() +// (and defines them too, which is included by Parallel Mode). // and define operator ""s in C++14 #else #define s ( diff --git a/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc b/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc index ca238f9cbd1..dcfccf18a03 100644 --- a/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc +++ b/libstdc++-v3/testsuite/20_util/pair/dangling_ref.cc @@ -1,7 +1,7 @@ // { dg-do compile { target c++11 } } // { dg-options "-Wno-unused-variable" } // { dg-additional-options "-D_GLIBCXX_DEBUG" { target c++17_down } } - +// { dg-skip-if "cannot mix with DEBUG" { *-*-* } { "-D_GLIBCXX_PARALLEL" } } #include #if __cplusplus >= 202002L diff --git a/libstdc++-v3/testsuite/20_util/tuple/dangling_ref.cc b/libstdc++-v3/testsuite/20_util/tuple/dangling_ref.cc index b2dcf359438..e7271a58a2f 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/dangling_ref.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/dangling_ref.cc @@ -1,7 +1,7 @@ // { dg-do compile { target c++11 } } // { dg-options "-Wno-unused-variable" } // { dg-additional-options "-D_GLIBCXX_DEBUG" { target c++17_down } } - +// { dg-skip-if "cannot mix with DEBUG" { *-*-* } { "-D_GLIBCXX_PARALLEL" } } #include #include