[llvm-bugs] [Bug 38904] New: thread-safety-analysis doesn't know about std::optional
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 11 15:22:55 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38904
Bug ID: 38904
Summary: thread-safety-analysis doesn't know about
std::optional
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: lukasza at chromium.org
CC: llvm-bugs at lists.llvm.org
Repro source code: https://godbolt.org/z/2XG89f (most important parts are
inlined below):
void test2() {
std::optional<AutoLock> maybe_autolock;
maybe_autolock.emplace(AutoLock(g_lock));
g_value += 1;
}
For real code where this bug would have mattered see
https://crbug.com/881875#c1 and
services/ws/public/cpp/gpu/context_provider_command_buffer.cc in Chromium which
calls base::Optional<base::AutoLock>::emplace(base::Lock&).
Unexpected error:
<source>:32:3: error: writing variable 'g_value' requires holding mutex
'g_lock' exclusively [-Werror,-Wthread-safety-analysis]
g_value += 1;
^
--
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/20180911/fedb79ae/attachment.html>
More information about the llvm-bugs
mailing list