https://bugs.llvm.org/show_bug.cgi?id=39234
Bug ID: 39234
Summary: Regression: Thread-safety annotation tests are failing
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
The following libc++ tests started failing with Clang's r342605 (aka
7d2cf6756ab9485584e7ade8675a44bc9edd2a54 in the monorepo):
FAIL: libc++ ::
libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
FAIL: libc++ ::
libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
FAIL: libc++ ::
libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
FAIL: libc++ ::
libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
r342605 is:
Author: Aaron Puchert <[email protected]>
Date: Thu Sep 20 00:39:27 2018 +0000
Thread Safety Analysis: warnings for attributes without arguments
Summary:
When thread safety annotations are used without capability arguments,
they are assumed to apply to `this` instead. So we warn when either
`this` doesn't exist, or the class is not a capability type.
This is based on earlier work by Josh Gao that was committed in
r310403,
but reverted in r310698 because it didn't properly work in template
classes. See also D36237.
The solution is not to go via the QualType of `this`, which is then a
template type, hence the attributes are not known because it could be
specialized. Instead we look directly at the class in which we are
contained.
Additionally I grouped two of the warnings together. There are two
issues here: the existence of `this`, which requires us to be a
non-static member function, and the appropriate annotation on the class
we are contained in. So we don't distinguish between not being in a
class and being static, because in both cases we don't have `this`.
The errors look like:
In file included from
[...]/llvm/projects/libcxx/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp:22:
[...]/llvm/projects/libcxx/include/mutex:501:53: error:
'release_capability' attribute without capability arguments refers to 'this',
but 'scoped_lock<_Mutex>' isn't annotated with 'capability' or
'scoped_lockable' attribute [-Werror,-Wthread-safety-attributes]
~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability())
{__m_.unlock();}
^
1 error generated.
Can you please investigate and suggest a fix to libc++? This failure wasn't
caught by the build bots because we apparently don't test libc++ ToT against
Clang ToT on a regular basis.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs