Index: runtime/src/kmp_tasking.c =================================================================== --- runtime/src/kmp_tasking.c +++ runtime/src/kmp_tasking.c @@ -576,15 +576,10 @@ static void __kmp_free_task_and_ancestors( kmp_int32 gtid, kmp_taskdata_t * taskdata, kmp_info_t * thread ) { - kmp_int32 children = 0; - kmp_int32 team_or_tasking_serialized = taskdata -> td_flags.team_serial || taskdata -> td_flags.tasking_ser; - KMP_DEBUG_ASSERT( taskdata -> td_flags.tasktype == TASK_EXPLICIT ); - if ( !team_or_tasking_serialized ) { - children = KMP_TEST_THEN_DEC32( (kmp_int32 *)(& taskdata -> td_allocated_child_tasks) ) - 1; - KMP_DEBUG_ASSERT( children >= 0 ); - } + kmp_int32 children = KMP_TEST_THEN_DEC32( (kmp_int32 *)(& taskdata -> td_allocated_child_tasks) ) - 1; + KMP_DEBUG_ASSERT( children >= 0 ); // Now, go up the ancestor tree to see if any ancestors can now be freed. while ( children == 0 ) @@ -599,16 +594,14 @@ taskdata = parent_taskdata; - // Stop checking ancestors at implicit task or if tasking serialized + // Stop checking ancestors at implicit task // instead of walking up ancestor tree to avoid premature deallocation of ancestors. - if ( team_or_tasking_serialized || taskdata -> td_flags.tasktype == TASK_IMPLICIT ) + if ( taskdata -> td_flags.tasktype == TASK_IMPLICIT ) return; - if ( !team_or_tasking_serialized ) { - // Predecrement simulated by "- 1" calculation - children = KMP_TEST_THEN_DEC32( (kmp_int32 *)(& taskdata -> td_allocated_child_tasks) ) - 1; - KMP_DEBUG_ASSERT( children >= 0 ); - } + // Predecrement simulated by "- 1" calculation + children = KMP_TEST_THEN_DEC32( (kmp_int32 *)(& taskdata -> td_allocated_child_tasks) ) - 1; + KMP_DEBUG_ASSERT( children >= 0 ); } KA_TRACE(20, ("__kmp_free_task_and_ancestors(exit): T#%d task %p has %d children; "