<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 - Analyzer: false-positives about unintialized value"
href="https://bugs.llvm.org/show_bug.cgi?id=35418">35418</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Analyzer: false-positives about unintialized value
</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>lebedev.ri@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre><a href="https://godbolt.org/g/5ipje4">https://godbolt.org/g/5ipje4</a>
Hand-reduced code:
#include <cassert>
void decode(unsigned width) {
assert(width > 0);
int base;
bool inited = false;
int i = 0;
if (i % width == 0) {
base = 512;
inited = true;
}
// assert(inited); // <- if i uncomment this, the warning is gone.
base+=1;
if (base >> 10)
assert(false);
}
I think it should be obvious from the code that `assert(inited);` will always
be reached with `inited == true`.
Also, problem 2: if i replace `base+=1;` with `base++;`, it would no longer
warn there.
For the reference, this is the full original code:
<a href="https://github.com/darktable-org/rawspeed/blob/ec958b8550d526ae8904691e96fb34959f69835b/src/librawspeed/decompressors/CrwDecompressor.cpp#L275">https://github.com/darktable-org/rawspeed/blob/ec958b8550d526ae8904691e96fb34959f69835b/src/librawspeed/decompressors/CrwDecompressor.cpp#L275</a></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>