<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 - False positive: Undefined or garbage value returned to caller"
href="https://bugs.llvm.org/show_bug.cgi?id=36953">36953</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>False positive: Undefined or garbage value returned to caller
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</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>normal
</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>vlad.bespalov@jetstreamsoft.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20143" name="attach_20143" title="minimal reproducer">attachment 20143</a> <a href="attachment.cgi?id=20143&action=edit" title="minimal reproducer">[details]</a></span>
minimal reproducer
possibly same origin as <a class="bz_bug_link
bz_status_NEW "
title="NEW - False positive: Undefined or garbage value returned to caller"
href="show_bug.cgi?id=16021">bug 16021</a> as it is about comparing 2 variables.
Full reproducer is attached.
-------------
// reproducer has an uninited status var
int status, a, b;
// prepare a & b
while (a < b) {
//modify a
if (break condition) {
status = -1;
break;
}
}
// we arrive here due to while condition is false or because of the break;
if (! (a < b)) {
status = 1;
}
// this line triggers the warning.
return status;
-----------
clang-check is called as
$ clang-check stupid.c -analyze -extra-arg -Xanalyzer -extra-arg
-analyzer-output=text
Also the notes describing the path issue in the clang-check output are:
------------
/home/Vlad.Bespalov/source/!9/stupid.c:5:5: note: Loop condition is false.
Execution continues on line 13
while (sent < len) {
^
/home/Vlad.Bespalov/source/!9/stupid.c:13:5: note: Taking false branch
if (! (sent < len)) {
^
------------
which is obviously wrong.
clang-check version:
------------
$ clang-check --version
LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):
LLVM version 6.0.0
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: amdfam10
------------</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>