[cfe-dev] [PATCH] libc++: help diagnosing the following std::atomic compile error

Richard Smith richard at metafoo.co.uk
Wed May 22 17:37:24 PDT 2013

On Wed, May 22, 2013 at 3:01 PM, John McCall <rjmccall at apple.com> wrote:

> On May 22, 2013, at 2:49 AM, Stephan Tolksdorf <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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130522/6d6b8219/attachment.html>

More information about the cfe-dev mailing list