[llvm-bugs] [Bug 43632] New: local static object not Thread safe on Ubuntu 16 clang 3.7

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 10 01:10:33 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43632

            Bug ID: 43632
           Summary: local static object not Thread safe on Ubuntu 16 clang
                    3.7
           Product: libc++
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: elia.mirov at gm.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Hi, 

We are using Clang 3.7 with flag -- -std=c++14
We found an issue with Singleton thread safe.

In our code we implemented “Meyers Singleton” as described in 
https://www.modernescpp.com/index.php/thread-safe-initialization-of-data
This is thread safe implementation guaranteed by std C++ 11 and has by far
better performance according to
https://www.modernescpp.com/index.php/thread-safe-initialization-of-a-singleton

However,  this implementation is not thread safe if using libc++ 11
compilation, as we happen to know now, and we had to add a lock_guard to
overcome this issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191010/afdebe45/attachment.html>


More information about the llvm-bugs mailing list