Skip to content

Commit 29c73b6

Browse files
committed
[OpenMP] Initialize taskgraph-related fields in task allocation
Fix a potential use of uninitialized is_taskgraph and tdg fields when a task is created outside of a taskgraph construct. These fields were previously left uninitialized, which could lead to undefined behavior when later accessed.
1 parent a095ebc commit 29c73b6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

openmp/runtime/src/kmp_tasking.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,8 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
16141614
taskdata->td_flags.freed = 0;
16151615
#if OMPX_TASKGRAPH
16161616
taskdata->td_flags.onced = 0;
1617+
taskdata->is_taskgraph = 0;
1618+
taskdata->tdg = nullptr;
16171619
#endif
16181620
KMP_ATOMIC_ST_RLX(&taskdata->td_incomplete_child_tasks, 0);
16191621
// start at one because counts current task and children

0 commit comments

Comments
 (0)