Hello, On Thu, 22 Jul 2021, Richard Biener via Gcc wrote:
> But how does TLS usage transfer between threads? On the gimple level > the TLS pointer is not visible and thus we'd happily CSE its address: Yes. All take-address operations then need to be encoded explicitely with a non-CSE-able internal function (or so): &x --> __ifn_get_tls_addr(&x); (&x in the argument just so that it's clear that it doesn't access the value at x and to get the current effects of address-taken marking of ADDR_EXPR). (Or of course, ADDR_EXPR could be taken as unstable when applied to TLS decls). Quite a big hammer IMHO. Ciao, Michael.