* ☂Josh Chia (謝任中): > If I use "static thread_local int cursor = 0;" then cursor is > thread-local and such a race should be impossible, but the generated > code for bar1() still has a branch. The GNU toolchain supports access to thread-local storage from other threads as an extension (subject to some constraints, e.g., TLS storage of other threads is gone after fork). So the optimization still wouldn't be valid. Thanks, Florian -- Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill