https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125436

--- Comment #2 from Kevin Puetz <puetzk at puetzk dot org> ---
This miscompilation also triggers if the access to a thread_local variable is
in the body of a "plain" function without __attribute((ms_abi)), but this is
inlined into the body of a function that is __attribute((ms_abi)).

That's the case I actually found it in - it was a function-scope `static
thread_local` buried inside an inline class method, which I called from a COM
`STDMETHOD(...)` override in a winelib .dll.so file. In that specific case, it
was %esi, rather than %edi, that was holding the return value and getting
corrupted.

In the process of minimizing it I must have eliminated one in-use register
somewhere because it shifted the allocation to %edi instead, but that still
demonstrated the general issue (not accounting for the volatile registers
clobbered by calling `__tls_get_addr`)

Reply via email to