diff --git a/libgomp/task.c b/libgomp/task.c index 53072d8ea81..828348c4cf4 100644 --- a/libgomp/task.c +++ b/libgomp/task.c @@ -1248,6 +1248,8 @@ gomp_task_run_post_handle_dependers (struct gomp_task *child_task, } } } + else + task->parent = NULL; if (taskgroup) { priority_queue_insert (PQ_TASKGROUP, &taskgroup->taskgroup_queue, diff --git a/libgomp/testsuite/libgomp.c/pr104385.c b/libgomp/testsuite/libgomp.c/pr104385.c new file mode 100644 index 00000000000..07495e65e58 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr104385.c @@ -0,0 +1,26 @@ +/* PR libgomp/104385 */ + +#include + +int +main () +{ + int j = 0; + #pragma omp parallel shared(j) num_threads(2) + { + #pragma omp barrier + #pragma omp master + #pragma omp task shared(j) + { + #pragma omp task depend(out: j) shared(j) + { + usleep (10000); + j = 1; + } + + #pragma omp task depend(inout: j) shared(j) + j += 1; + } + } + return j - 2; +}