https://bugs.kde.org/show_bug.cgi?id=496333
Bug ID: 496333 Summary: DRD does not detect thread hazards with C++ lambdas that capture by reference Classification: Developer tools Product: valgrind Version: 3.24 GIT Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: drd Assignee: bart.vanassche+...@gmail.com Reporter: pjfl...@wanadoo.fr Target Milestone: --- This example #include <future> #include <iostream> int main() { char counter = 0; auto future1 = std::async(std::launch::async, [&]() { counter++; }); auto future2 = std::async(std::launch::async, [&]() { return counter; }); future1.wait(); // Cast to int to print it as a numerical value rather than a character std::cout << (int)future2.get(); } from https://github.com/knatten/cpp-brain-teasers.git generates errors with both Helgrind and Thread Sanitizer on Linux with g++ and libstdc++. Nothing with Helgrind on FreeBSD with clang++/libc++. No error with DRD. /home/paulf/tools/valgrind/bin/valgrind --tool=drd --check-stack-var=yes -q ./back-from-the-future 1 I think that this is because the memory for the captured reference to counter is neither on the stack of the lambda nor on the heap. -- You are receiving this mail because: You are watching all bug changes.