__kmp_fork_call sets the enter_frame of the active task (th_curren_task)
before new parallel region begins. After the region is finished, the
enter_frame is cleared.
The old implementation of __kmpc_fork_call didn’t clear the enter_frame of active task.
Also, the way of initializing the enter_frame of the active task was wrong.
Consider the following two OpenMP programs.
The first program: Let R1 be the serialized parallel region that encloses another serialized
parallel region R2. Assume that thread that executes R2 is going to create a new serialized
parallel region R3 by executing __kmpc_fork_call. This thread is responsible to set enter_frame
of R2’s implicit task. Note that the information about R2’s implicit task is present inside
master_th->th.th_current_task at this moment, while lwt represents the information about
R1’s implicit task. The old implementation uses lwt and resets enter_frame of R1’s implicit
task instead of R2’s implicit task. The new implementation uses
master_th->th.th_current_task instead.
The second program: Consider the OpenMP program that contains parallel region R1 which encloses
an explicit task T. Assume that thread should create another parallel region R2 during the
execution of the T. The __kmpc_fork_call is responsible to create R2 and set enter frame of T
whose information is present inside the master_th->th.th_current_task.
Old implementation tries to set the frame of parent_team->t.t_implicit_task_taskdata[tid]
which corresponds to the implicit task of the R1, instead of T.