This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] nptl: Fix invalid Systemtap probe in pthread_join [BZ #24211]
* Carlos O'Donell:
>> - LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
>> + LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd_result);
> What prevents the compiler from optimizing away pd_result and using
> pd->result directly again?
The __free_tcb call acts as an implicit optimization barrier, like any
function call that doesn't have attributes that say otherwise.
> The actions of __free_tcb() and their consequences are not visible
> to the compiler.
Exactly. The compiler cannot rematerialize the value from pd->result
because it has no way of knowing if the value is still the same.