https://bugs.llvm.org/show_bug.cgi?id=32455

            Bug ID: 32455
           Summary: False Positive PthreadLockChecker Use destroyed lock
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: kreme...@apple.com
          Reporter: xiangzha...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Hi LLVM developers,

Testcase: libburn
https://dev.lovelyhq.com/libburnia/libburn/blob/master/libburn/libdax_msgs.c#L209

208     #ifndef LIBDAX_MSGS_SINGLE_THREADED
209      if(pthread_mutex_destroy(&(o->lock_mutex))!=0) {
          ^
          Assuming the condition is true        

          ^
          Taking true branch    

210        pthread_mutex_unlock(&(o->lock_mutex));
           ^
           This lock has already been destroyed

211        pthread_mutex_destroy(&(o->lock_mutex));
212      }
213     #endif


But if the return value of pthread_mutex_destroy is NOT 0
https://github.molgen.mpg.de/git-mirror/glibc/blob/master/nptl/pthread_mutex_destroy.c#L32
then mutex->__data.__kind will not be set! so it might be still able to use
pthread_mutex_unlock to set mutex object's members
https://github.molgen.mpg.de/git-mirror/glibc/blob/master/nptl/pthread_mutex_unlock.c#L49


Regards,
Leslie Zhai

-- 
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

Reply via email to