<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 - Assertion failure in NonNullParamChecker::checkPreCall"
href="https://bugs.llvm.org/show_bug.cgi?id=37802">37802</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion failure in NonNullParamChecker::checkPreCall
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dcoughlin@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alexfh@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>ekarpenkov@apple.com, llvm-bugs@lists.llvm.org, noqnoqneo@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>$ cat test-NonNullParamChecker__checkPreCall.cc
void *operator new(unsigned long, void *h) { return h; }
struct J {
int *p;
};
class X {
void *ar;
public:
X(void *t) : ar(t) {}
template <typename T>
void f(const T &t) {
new (ar) T(t);
}
};
class Y {
public:
template <typename T>
void f(T &&);
void f(J t) {
f(*t.p);
}
};
class Z {
int at() const {}
public:
Z(const Z &other) {
other.au(X(this));
}
template <typename T>
void au(T t) const {
void *c = const_cast<Z *>(this);
if(at()) {
t.f(*static_cast<J *>(c));
} else {
t.f(*static_cast<bool *>(c));
}
}
};
Z g() {
Z az = g();
Z e = az;
Y d;
e.au(d);
}
$ ./clang-tidy -checks=-*,clang-analyzer*
test-NonNullParamChecker__checkPreCall.cc --
assert.h assertion failed at
llvm/tools/clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp:102 in
void (anonymous namespace)::NonNullParamChecker::checkPreCall(const
clang::ento::CallEvent &, clang::ento::CheckerContext &) const:
!haveRefTypeParam || DV->getAs<Loc>()
@ 0x55766e235e06 __assert_fail
@ 0x55766bd73f9e clang::ento::check::PreCall::_checkCall<>()
@ 0x55766bf4a2f9
clang::ento::CheckerManager::runCheckersForCallEvent()
@ 0x55766bf8a191 clang::ento::ExprEngine::evalCall()
@ 0x55766bf89fa2 clang::ento::ExprEngine::VisitCallExpr()
@ 0x55766bf5d283 clang::ento::ExprEngine::Visit()
@ 0x55766bf5980e clang::ento::ExprEngine::ProcessStmt()
@ 0x55766bf5952b clang::ento::ExprEngine::processCFGElement()
@ 0x55766bf77b45 clang::ento::CoreEngine::HandlePostStmt()
@ 0x55766bf76f9d clang::ento::CoreEngine::ExecuteWorkList()
@ 0x55766bcaf056 (anonymous
namespace)::AnalysisConsumer::ActionExprEngine()
@ 0x55766bcaebd6 (anonymous namespace)::AnalysisConsumer::HandleCode()
@ 0x55766bc9a934 (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit()</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>