Open Quuxplusone opened 4 years ago
Attached lock-64f111.c
(113 bytes, text/plain): reduced test case
Attached lock-64f111.sh
(3213 bytes, text/plain): shell script
This fixes it.
diff --git a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
index 8649b8b96dd..6fb92e0c77a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -260,12 +260,12 @@ void PthreadLockChecker::AcquireLock(CheckerContext &C,
const CallExpr *CE,
std::tie(lockFail, lockSucc) = state->assume(retVal);
break;
case XNUSemantics:
- std::tie(lockSucc, lockFail) = state->assume(retVal);
+ std::tie(lockFail, lockSucc) = state->assume(retVal);
break;
default:
llvm_unreachable("Unknown tryLock locking semantics");
}
- assert(lockFail && lockSucc);
+ assert(lockFail || lockSucc);
C.addTransition(lockFail);
} else if (semantics == PthreadSemantics) {
Please ignore the above comment.
lock-64f111.c
(113 bytes, text/plain)lock-64f111.sh
(3213 bytes, text/plain)