<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 - uninitialized value false positive with identical conditions"
href="https://bugs.llvm.org/show_bug.cgi?id=35001">35001</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>uninitialized value false positive with identical conditions
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.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>ssapa@arista.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>clang version 5.0.0 (trunk)
Target: i686-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-redhat-linux/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/5.4.0
Selected GCC installation: /usr/bin/../lib/gcc/i686-redhat-linux/5.4.0
Candidate multilib: .;@m32
Selected multilib: .;@m32
This snippet (foo.cpp) makes the analyzer to warn about an uninitialized value:
#include <iostream>
void run( double limit ) {
int a;
if ( limit > 0 ) {
a = 1;
}
if ( limit > 0 ) {
std::cout << a;
}
}
clang++ --analyze -Xanalyzer -analyzer-output=text -std=c++11 foo.cpp
foo.cpp:10:7: warning: 1st function call argument is an uninitialized value
std::cout << a;
^ ~
foo.cpp:4:4: note: 'a' declared without an initial value
int a;
^~~~~
foo.cpp:6:4: note: Taking false branch
if ( limit > 0 ) {
^
foo.cpp:9:4: note: Taking true branch
if ( limit > 0 ) {
^
foo.cpp:10:7: note: 1st function call argument is an uninitialized value
std::cout << a;
^ ~
1 warning generated.
Making the value type an 'int' does not show the same symptoms, ie. void run(
int limi )</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>