public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20
@ 2020-05-06 10:23 redi at gcc dot gnu.org
  2020-05-06 10:24 ` [Bug libstdc++/94971] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 10:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

            Bug ID: 94971
           Summary: [10/11 Regression] Parallel Mode cannot be used in
                    C++20
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

This fails to compile in C++20 mode:

#define _GLIBCXX_PARALLEL 1
#include <algorithm>

The new std::lexicographical_compare_three_way algo I added is in the wrong
namespace.

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

* [Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20
  2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
@ 2020-05-06 10:24 ` redi at gcc dot gnu.org
  2020-05-07 20:19 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 10:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-05-06
   Target Milestone|---                         |10.2
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm not going to fix this for 10.1, I doubt anybody is using our non-standard
parallel mode with C++20 (they should be using the standard parallel algos
added in C++17 instead).

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

* [Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20
  2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
  2020-05-06 10:24 ` [Bug libstdc++/94971] " redi at gcc dot gnu.org
@ 2020-05-07 20:19 ` redi at gcc dot gnu.org
  2020-05-07 20:44 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-07 20:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Parallel mode is basically broken for any new C++ standard.

All the tests for C++20 constexpr algorithms fail, because the std::__parallel
versions are not constexpr:

FAIL: 25_algorithms/replace_if/constexpr.cc (test for excess errors)
Excess errors:
/home/jwakely/src/gcc/libstdc++-v3/testsuite/25_algorithms/replace_if/constexpr.cc:29:
error: call to non-'constexpr' function 'void
std::__parallel::replace_if(_FIter, _FIter, _Predicate, const _Tp&) [with
_FIter = int*; _Predicate = test()::<lambda(int)>; _Tp = int]'
/home/jwakely/src/gcc/libstdc++-v3/testsuite/25_algorithms/replace_if/constexpr.cc:34:
error: non-constant condition for static assertion
/home/jwakely/src/gcc/libstdc++-v3/testsuite/25_algorithms/replace_if/constexpr.cc:34:
error: 'constexpr bool test()' called in a constant expression


I think that could be fixed by adding _GLIBCXX20_CONSTEXPR to them and then at
the beginning of each function:

#if __cpp_lib_is_constant_evaluated
if (std::is_constant_evaluated())
  return _GLIBCXX_STD_A::replace_if(...);
#endif


These fail to compile because the parallel algos don't support move semantics:
FAIL: 25_algorithms/stable_sort/49559.cc (test for excess errors)
FAIL: 25_algorithms/stable_sort/moveable.cc (test for excess errors)
FAIL: 25_algorithms/stable_sort/moveable2.cc (test for excess errors)
FAIL: 25_algorithms/partial_sort/moveable.cc (test for excess errors)
FAIL: 25_algorithms/nth_element/moveable.cc (test for excess errors)
FAIL: 25_algorithms/for_each/1.cc (test for excess errors)
FAIL: 25_algorithms/for_each/for_each_n.cc (test for excess errors)


These time out, I didn't check why:

FAIL: 25_algorithms/move/deque_iterators/1.cc execution test
FAIL: 25_algorithms/move_backward/deque_iterators/1.cc execution test
FAIL: 25_algorithms/copy_backward/deque_iterators/1.cc execution test


This fails because the new overload of std::search that takes a searcher isn't
declared in std::__parallel:

FAIL: 25_algorithms/search/searcher.cc (test for excess errors)
Excess errors:
/home/jwakely/src/gcc/libstdc++-v3/testsuite/25_algorithms/search/searcher.cc:39:
error: no matching function for call to 'search(int [2], int*, nocopy)'

These fail at runtime, because the parallel algos copy instead of moving:

FAIL: 26_numerics/accumulate/lwg2055.cc execution test
FAIL: 26_numerics/inner_product/lwg2055.cc execution test

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

* [Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20
  2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
  2020-05-06 10:24 ` [Bug libstdc++/94971] " redi at gcc dot gnu.org
  2020-05-07 20:19 ` redi at gcc dot gnu.org
@ 2020-05-07 20:44 ` cvs-commit at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-07 20:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:9c24e97a97aaad4ad0500170cbae4f387d82ddd6

commit r11-180-g9c24e97a97aaad4ad0500170cbae4f387d82ddd6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu May 7 21:43:49 2020 +0100

    libstdc++: Fix some C++20 algorithms to work in parallel mode

    Some new algorithms need to use _GLIBCXX_STD_A to refer to the "normal"
    version of the algorithm, to workaround the namespace dance done for
    parallel mode.

            PR libstdc++/94971 (partial)
            * include/bits/ranges_algo.h (ranges::__sample_fn): Qualify
            std::sample using macro to work in parallel mode.
            (__sort_fn): Likewise for std::sort.
            (ranges::__nth_element_fn): Likewise for std::nth_element.
            * include/bits/stl_algobase.h (lexicographical_compare_three_way):
            Likewise for std::__min_cmp.
            * include/parallel/algobase.h (lexicographical_compare_three_way):
            Add to namespace std::__parallel.

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

* [Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20
  2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-05-07 20:44 ` cvs-commit at gcc dot gnu.org
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2020-11-04 13:36 ` cvs-commit at gcc dot gnu.org
  2020-11-04 13:38 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

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

* [Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20
  2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2020-11-04 13:36 ` cvs-commit at gcc dot gnu.org
  2020-11-04 13:38 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-04 13:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e0af865ab9d9d5b6b3ac7fdde26cf9bbf635b6b4

commit r11-4722-ge0af865ab9d9d5b6b3ac7fdde26cf9bbf635b6b4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Nov 4 13:36:32 2020 +0000

    libstdc++: Define new C++17 std::search overload for Parallel Mode [PR
94971]

    libstdc++-v3/ChangeLog:

            PR libstdc++/94971
            * include/bits/stl_algo.h (search(FIter, FIter, const Searcher):
            Adjust #if condition.
            * include/parallel/algo.h (search(FIter, FIter, const Searcher&):
            Define new overload for C++17.

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

* [Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20
  2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-11-04 13:36 ` cvs-commit at gcc dot gnu.org
@ 2020-11-04 13:38 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-04 13:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> This fails to compile in C++20 mode:
> 
> #define _GLIBCXX_PARALLEL 1
> #include <algorithm>
> 
> The new std::lexicographical_compare_three_way algo I added is in the wrong
> namespace.

This is fixed.

(In reply to Jonathan Wakely from comment #2)
> All the tests for C++20 constexpr algorithms fail, because the
> std::__parallel versions are not constexpr:
[...]
> I think that could be fixed by adding _GLIBCXX20_CONSTEXPR to them and then
> at the beginning of each function:
> 
> #if __cpp_lib_is_constant_evaluated
> if (std::is_constant_evaluated())
>   return _GLIBCXX_STD_A::replace_if(...);
> #endif

I don't plan to do that. 

> These fail to compile because the parallel algos don't support move
> semantics:
> FAIL: 25_algorithms/stable_sort/49559.cc (test for excess errors)
> FAIL: 25_algorithms/stable_sort/moveable.cc (test for excess errors)
> FAIL: 25_algorithms/stable_sort/moveable2.cc (test for excess errors)
> FAIL: 25_algorithms/partial_sort/moveable.cc (test for excess errors)
> FAIL: 25_algorithms/nth_element/moveable.cc (test for excess errors)
> FAIL: 25_algorithms/for_each/1.cc (test for excess errors)
> FAIL: 25_algorithms/for_each/for_each_n.cc (test for excess errors)

This has been broken for years.

> This fails because the new overload of std::search that takes a searcher
> isn't declared in std::__parallel:
> 
> FAIL: 25_algorithms/search/searcher.cc (test for excess errors)
> Excess errors:
> /home/jwakely/src/gcc/libstdc++-v3/testsuite/25_algorithms/search/searcher.
> cc:39: error: no matching function for call to 'search(int [2], int*,
> nocopy)'

Fixed.

> These fail at runtime, because the parallel algos copy instead of moving:
> 
> FAIL: 26_numerics/accumulate/lwg2055.cc execution test
> FAIL: 26_numerics/inner_product/lwg2055.cc execution test

Not going to be fixed.

I'm going to close this as WONTFIX. Parallel Mode should be considered legacy
code in maintenance mode only.

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

end of thread, other threads:[~2020-11-04 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 10:23 [Bug libstdc++/94971] New: [10/11 Regression] Parallel Mode cannot be used in C++20 redi at gcc dot gnu.org
2020-05-06 10:24 ` [Bug libstdc++/94971] " redi at gcc dot gnu.org
2020-05-07 20:19 ` redi at gcc dot gnu.org
2020-05-07 20:44 ` cvs-commit at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2020-11-04 13:36 ` cvs-commit at gcc dot gnu.org
2020-11-04 13:38 ` redi at gcc dot gnu.org

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).