[cfe-dev] [PATCH] libc++: help diagnosing the following std::atomic compile error
st at quanttec.com
Thu May 23 07:26:02 PDT 2013
On 23.05.13 02:37, Richard Smith wrote:
> On Wed, May 22, 2013 at 3:01 PM, John McCall <rjmccall at apple.com
> <mailto:rjmccall at apple.com>> wrote:
> On May 22, 2013, at 2:49 AM, Stephan Tolksdorf <st at quanttec.com
> <mailto:st at quanttec.com>> wrote:
> > On 22.05.13 01:04, Howard Hinnant wrote:
> >> I recommend filing a bug against clang on this. I am hesitant
> to commit the libc++ fix due to David Chisnall's concerns. If the
> clang team reassigns the bug to libc++, then I will commit the
> libc++ solution.
> > In case anyone has missed the previous reference to
> http://llvm.org/bugs/show_bug.cgi?id=16056 and is considering a
> decision on how to proceed, I'd like to describe the consequence of
> that issue for the current _Atomic-based implementation of <atomic>:
> > If you initialize a static atomic variable with a constant
> expression (e.g. for some kind of lazy initialization scheme), your
> value is not constant initialized as expected but instead is
> dynamically initialized at program startup (because clang currently
> doesn't treat _Atomic(T) as a literal type). This may make your code
> vulnerable to the infamous "static initialization order fiasco",
> which can result in difficult to find bugs.
> That seems fixable; _Atomic(T) should be a literal type if T is.
> Agreed, and fixed in r182541.
Thanks a lot!
More information about the cfe-dev