[LLVMbugs] [Bug 10141] New: pthread_mutex_lock is assumed to always return 0

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 15 02:11:10 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10141

           Summary: pthread_mutex_lock is assumed to always return 0
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: scott at scottnz.com
                CC: llvmbugs at cs.uiuc.edu


With this code

    {
        int lock_res = pthread_mutex_lock(&o->lock);
        if(lock_res != 0) return false;
        if(o->destroyed)
        {
            pthread_mutex_unlock(&o->lock);
            return false;
        }
    }

Clang says:

us_datacoding_datacoding.c:163:21: warning: This statement is never executed
                if(lock_res != 0) return false;

pointing at the return false;

In my case, the mutex o->lock is created as PTHREAD_MUTEX_ERRORCHECK which is
allowed to return !0.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list