[llvm-bugs] [Bug 35001] New: uninitialized value false positive with identical conditions
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 19 10:18:19 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=35001
Bug ID: 35001
Summary: uninitialized value false positive with identical
conditions
Product: clang
Version: 5.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: ssapa at arista.com
CC: llvm-bugs at lists.llvm.org
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 )
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171019/5d6bebfd/attachment.html>
More information about the llvm-bugs
mailing list