<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 - cli-wrapper-mpxtable.cpp - suspicious always true comparison"
href="https://bugs.llvm.org/show_bug.cgi?id=52263">52263</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>cli-wrapper-mpxtable.cpp - suspicious always true comparison
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>static void PrintBTEntry(lldb::addr_t lbound, lldb::addr_t ubound,
uint64_t value, uint64_t meta,
lldb::SBCommandReturnObject &result) {
const lldb::addr_t one_cmpl64 = ~((lldb::addr_t)0);
const lldb::addr_t one_cmpl32 = ~((uint32_t)0);
if ((lbound == one_cmpl64 || one_cmpl32) && ubound == 0) {
result.Printf("Null bounds on map: pointer value = 0x%" PRIu64 "\n",
value);
} else {
result.Printf(" lbound = 0x%" PRIu64 ",", lbound);
result.Printf(" ubound = 0x%" PRIu64 , ubound);
result.Printf(" (pointer value = 0x%" PRIu64 ",", value);
result.Printf(" metadata = 0x%" PRIu64 ")\n", meta);
}
}
Coverity is warning:
if ((lbound == one_cmpl64 || one_cmpl32) && ubound == 0) {
CID undefined (#1 of 1): Logical vs. bitwise operator
(CONSTANT_EXPRESSION_RESULT)logical_vs_bitwise: The expression lbound ==
18446744073709551615UL /* one_cmpl64 */ || true /* one_cmpl32 */ is suspicious
because it performs a Boolean operation on a constant other than 0 or 1.
Should this be:
if ((lbound == one_cmpl64 || lbound == one_cmpl32) && ubound == 0) {</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>