aboutsummaryrefslogtreecommitdiff
path: root/libgomp/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/task.c')
-rw-r--r--libgomp/task.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libgomp/task.c b/libgomp/task.c
index 30cd046..7766535 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -2465,6 +2465,7 @@ gomp_create_artificial_team (void)
struct gomp_task_icv *icv;
struct gomp_team *team = gomp_new_team (1);
struct gomp_task *task = thr->task;
+ struct gomp_task **implicit_task = &task;
icv = task ? &task->icv : &gomp_global_icv;
team->prev_ts = thr->ts;
thr->ts.team = team;
@@ -2477,17 +2478,25 @@ gomp_create_artificial_team (void)
thr->ts.static_trip = 0;
thr->task = &team->implicit_task[0];
gomp_init_task (thr->task, NULL, icv);
- if (task)
+ while (*implicit_task
+ && (*implicit_task)->kind != GOMP_TASK_IMPLICIT)
+ implicit_task = &(*implicit_task)->parent;
+ if (*implicit_task)
{
- thr->task = task;
+ thr->task = *implicit_task;
gomp_end_task ();
- free (task);
+ free (*implicit_task);
thr->task = &team->implicit_task[0];
}
#ifdef LIBGOMP_USE_PTHREADS
else
pthread_setspecific (gomp_thread_destructor, thr);
#endif
+ if (implicit_task != &task)
+ {
+ *implicit_task = thr->task;
+ thr->task = task;
+ }
}
/* The format of data is: