[LLVMbugs] [Bug 23235] New: Multiple races reported in std::async (TSan)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Apr 14 17:10:17 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23235
Bug ID: 23235
Summary: Multiple races reported in std::async (TSan)
Product: libc++
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: oleg at smolsky.net
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
Created attachment 14204
--> https://llvm.org/bugs/attachment.cgi?id=14204&action=edit
TSan output
I've just noticed TSan warnings when using std::async on Linux. A small example
is below. Compiled with Clang 3.6 and linked against an instrumented version of
libc++:
/opt/clang36/bin/clang++ -std=c++14 -g -fno-omit-frame-pointer
-fsanitize=thread -stdlib=libc++ -fcolor-diagnostics future.cpp -Wl,-rpath
/opt/clang36/lib-tsan -lc++abi -o future
#include <iostream>
#include <memory>
#include <future>
#include <atomic>
std::atomic<int> _counter;
int main()
{
_counter = 1;
auto f = std::async(std::launch::async,
[]{
_counter += 2;
return true;
});
std::cout << "Result: " << std::boolalpha << f.get() << "\n";
return 0;
}
--
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/20150415/869afd7b/attachment.html>
More information about the llvm-bugs
mailing list