Re: g++ and suppressing threadsafe-statics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 09.10.19 um 11:19 schrieb Jonathan Wakely:
> 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.
> 

Ok. Looks like constinit (C++20) and a constexpr user-defined ctor could
solve the problem.
Thanks for pointing me into the right direction.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux