<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Regression: Thread-safety annotation tests are failing"
   href="https://bugs.llvm.org/show_bug.cgi?id=39234">39234</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: Thread-safety annotation tests are failing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ldionne@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aaronpuchert@alice-dsl.net, llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 <<a href="mailto:aaronpuchert@alice-dsl.net">aaronpuchert@alice-dsl.net</a>>
    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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>