I haven't been able to reproduce so far.
Here is however a patch that I think will fix the problem. At least
failing tests are UNRESOLVED on my system.
libstdc++: Fix broken _GLIBCXX_PARALLEL mode
Add missing <parallel/search.h> include in <parallel/algobase.h>.
Detect availability of <omp.h> in tests needing it to make them
UNSUPPORTED
rather than PASS when header is missing.
libstdc++-v3/ChangeLog:
* include/parallel/algobase.h: Include <parallel/search.h>.
* testsuite/lib/libstdc++.exp (check_effective_target_omp):
New.
* testsuite/17_intro/headers/c++2011/parallel_mode.cc:
Add { dg-require-effective-target omp }.
* testsuite/17_intro/headers/c++2014/parallel_mode.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/parallel_mode.cc:
Likewise.
Ok to commit ?
On 01/06/2023 23:57, Jonathan Wakely wrote:
On Thu, 1 Jun 2023, 21:37 François Dumont via Libstdc++,
<libstd...@gcc.gnu.org <mailto:libstdc%2b...@gcc.gnu.org>> wrote:
It's of course not as easy as I thought.
I would never have detected this problem on my system because I'm
missing omp.h.
I've implemented and added a:
// { dg-require-effective-target omp }
so that now those tests are UNRESOLVED rather than PASS.
Now I've install OMP and try to rebuild lib to reproduce the failure.
You shouldn't need to install anything, just build gcc and don't
configure it with --disable-libgomp
I haven't used --disable-libgomp. But maybe when I run configure the 1st
time it tried to detect OMP install and failed to find it as I just
installed it.
I'll tried to rebuild everything to see if I can eventually have those
tests PASS.
François
diff --git a/libstdc++-v3/include/parallel/algobase.h b/libstdc++-v3/include/parallel/algobase.h
index 4e4cc0fa0f2..9e5b86558e4 100644
--- a/libstdc++-v3/include/parallel/algobase.h
+++ b/libstdc++-v3/include/parallel/algobase.h
@@ -41,6 +41,7 @@
#include <parallel/algorithmfwd.h>
#include <parallel/find.h>
#include <parallel/find_selectors.h>
+#include <parallel/search.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc
index ccad7694083..7e5c2999c7a 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc
@@ -18,6 +18,7 @@
// { dg-options "-std=gnu++11" }
// { dg-do compile { target c++11 } }
// { dg-require-normal-mode "" }
+// { dg-require-effective-target omp }
#if __has_include(<omp.h>)
# define _GLIBCXX_PARALLEL 1
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/parallel_mode.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/parallel_mode.cc
index 604dbda7c32..bc828de0ed6 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2014/parallel_mode.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/parallel_mode.cc
@@ -18,6 +18,7 @@
// { dg-options "-std=gnu++14" }
// { dg-do compile { target c++14 } }
// { dg-require-normal-mode "" }
+// { dg-require-effective-target omp }
#if __has_include(<omp.h>)
# define _GLIBCXX_PARALLEL 1
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2017/parallel_mode.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2017/parallel_mode.cc
index 0fa7fae8d27..7c829249645 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2017/parallel_mode.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2017/parallel_mode.cc
@@ -17,6 +17,7 @@
// { dg-do compile { target c++17 } }
// { dg-require-normal-mode "" }
+// { dg-require-effective-target omp }
#if __has_include(<omp.h>)
# define _GLIBCXX_PARALLEL 1
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index c83147ce99a..0207a15c57e 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1421,6 +1421,14 @@ proc check_effective_target_tzdb { } {
}]
}
+# Return 1 if OMP is available.
+proc check_effective_target_omp { } {
+ return [check_v3_target_prop_cached et_omp {
+ set cond "__has_include(<omp.h>)"
+ return [v3_check_preprocessor_condition omp $cond]
+ }]
+}
+
set additional_prunes ""
if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \