[Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20

2020-11-04 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |WONTFIX

--- Comment #6 from Jonathan Wakely  ---
(In reply to Jonathan Wakely from comment #0)
> This fails to compile in C++20 mode:
> 
> #define _GLIBCXX_PARALLEL 1
> #include 
> 
> 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.

[Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20

2020-11-04 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

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

commit r11-4722-ge0af865ab9d9d5b6b3ac7fdde26cf9bbf635b6b4
Author: Jonathan Wakely 
Date:   Wed Nov 4 13:36:32 2020 +

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.

[Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20

2020-07-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|10.2|10.3

--- Comment #4 from Richard Biener  ---
GCC 10.2 is released, adjusting target milestone.

[Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20

2020-05-07 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

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

commit r11-180-g9c24e97a97aaad4ad0500170cbae4f387d82ddd6
Author: Jonathan Wakely 
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.

[Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20

2020-05-07 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

--- Comment #2 from Jonathan Wakely  ---
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()::; _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

[Bug libstdc++/94971] [10/11 Regression] Parallel Mode cannot be used in C++20

2020-05-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94971

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