summaryrefslogtreecommitdiff
path: root/libgomp/task.c
diff options
context:
space:
mode:
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-09 02:21:43 +0000
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-09 02:21:43 +0000
commitce9ff32cc628753b0112022b97bbdc4efe453b9e (patch)
tree34b694493aa13f6544581b57928cb2b0a952d54a /libgomp/task.c
parentadb6e76b38b612dc7baaff87a78cd0ae40d8798c (diff)
downloadgcc-ce9ff32cc628753b0112022b97bbdc4efe453b9e.tar.gz
PR libgomp/51376
* task.c (GOMP_taskwait): Don't access task->children outside of task_lock mutex region. (GOMP_task): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182151 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/task.c')
-rw-r--r--libgomp/task.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libgomp/task.c b/libgomp/task.c
index d3d72663f35..4b75850072b 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -116,10 +116,11 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
}
else
fn (data);
- if (task.children)
+ if (team != NULL)
{
gomp_mutex_lock (&team->task_lock);
- gomp_clear_parent (task.children);
+ if (task.children != NULL)
+ gomp_clear_parent (task.children);
gomp_mutex_unlock (&team->task_lock);
}
gomp_end_task ();
@@ -290,8 +291,9 @@ GOMP_taskwait (void)
struct gomp_task *child_task = NULL;
struct gomp_task *to_free = NULL;
- if (task == NULL || task->children == NULL)
+ if (task == NULL || team == NULL)
return;
+
gomp_mutex_lock (&team->task_lock);
while (1)
{