For debugging purposes, I need to be able to find the master thread
in the thread pool.
Without this patch, I see over 20 failures in the tests that I've
written for GDB.
I've also tested this in the gcc tree - no regressions.
libgomp/ChangeLog:
* team.c (gomp_team_start): Initialize pool->threads[0].
---
libgomp/team.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libgomp/team.c b/libgomp/team.c
index 2b2e9750da5..e331c9b72c0 100644
--- a/libgomp/team.c
+++ b/libgomp/team.c
@@ -477,11 +477,17 @@ gomp_team_start (void (*fn) (void *), void *data,
unsigned nthreads,
make no effort to expand gomp_threads_size geometrically. */
if (nthreads >= pool->threads_size)
{
+ bool need_init = (pool->threads == NULL);
pool->threads_size = nthreads + 1;
pool->threads
= gomp_realloc (pool->threads,
pool->threads_size
* sizeof (struct gomp_thread *));
+ if (need_init)
+ {
+ /* Add current (master) thread to threads[]. */
+ pool->threads[0] = thr;
+ }
}
/* Release existing idle threads. */