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: unassignedclangb...@nondot.org
Reporter: luka...@chromium.org
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs