g++ and suppressing threadsafe-statics
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Oct 9 09:19:00 GMT 2019
On Wed, 9 Oct 2019 at 04:49, Klaus Doldinger wrote:
>
> Hi all,
>
> following is an example regarding the generation of guards for the
> static m in template X.
I didn't check the implementation, but according to the documentation,
-fno-threadsafe-statics only affects local static, so it's
unsurprising that it doesn't have any effect on a static member
variable.
For the local static variable, GCC and Clang still emit the guard
variable with -fno-threadsafe-statics but they do not emit the code to
use that variable (there are no calls to __cxa_guard_acquire or
__cxa_guard_release). I believe the guard variable stills gets be
emitted for ABI reasons, because another translation unit compiled
without -fno-threadsafe-statics might be expecting it to exist.
More information about the Gcc-help
mailing list