[llvm-bugs] [Bug 33504] New: Thread Safety Analysis [-Wthread-safety-analysis] work wrong with shared lock

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 19 01:45:00 PDT 2017


            Bug ID: 33504
           Summary: Thread Safety Analysis [-Wthread-safety-analysis] work
                    wrong with shared lock
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: antinettigu at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18656
  --> https://bugs.llvm.org/attachment.cgi?id=18656&action=edit
Example code

When I use -Wthread-safety-analysis flag for code with wrapper for
std::shared_lock I have warning:

main.cpp:110:1: warning: releasing mutex 'lg_shared' using shared access,
expected exclusive access [-Wthread-safety-analysis]

So RELEASE_SHARED() attribute not works with ACQUIRE_SHARED() for scoped
capability. Example code in attachment.

build command:
clang++-4.0 -o main main.cpp -std=c++14 -lboost_system -lboost_thread -pthread

clang++-4.0 -v
clang version 4.0.1-svn305187-1~exp1 (branches/release_40)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

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/20170619/73f8e114/attachment-0001.html>

More information about the llvm-bugs mailing list