[llvm-bugs] [Bug 38181] New: std::future does not acquire lock in __has_future_attached

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 16 09:32:07 PDT 2018


            Bug ID: 38181
           Summary: std::future does not acquire lock in
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mattvera at google.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

std::future does not acquire lock in __has_future_attached, which causes a data
race that can be repro'd with the following test case. Compile with
-fsanitize=thread to see the TSAN warnings.

#include <future>
#include <gtest/gtest.h> // googletest header file

namespace {

int DoNothingButReturn()  {
  return 42;

TEST(FutureTest, SomeTest) {
  std::async(std::launch::async, DoNothingButReturn);

}  // namespace

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/20180716/2dcdfc43/attachment.html>

More information about the llvm-bugs mailing list