https://llvm.org/bugs/show_bug.cgi?id=28872
Bug ID: 28872 Summary: Missing uninitialized variable warning. Product: clang Version: unspecified Hardware: Macintosh OS: MacOS X Status: NEW Severity: normal Priority: P Component: Static Analyzer Assignee: kreme...@apple.com Reporter: mathieu.b...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Hi Code such as: int main(void) { int value = value; // value is garbage, no warning is generated return 0; } Does not trigger any warning. Using the uninitialized value to access an array or any STL container (e.g. std::map) does not trigger any warnings either. e.g. std::map<int> hashmap; int foo = hashmap[foo]; On the other hand, the proper warning appears in code like this: int foo(int bar) { return bar; } int main(void) { int value = foo(value); // <-- proper warning is generated } I'm not even sure why C++ allows such syntax (maybe some kind of shortcut for non plain-old-data / classes?) but it sure caused a (easy to track down) bug in the code I was working on. NOTE: I did not know which clang version to select from the Bugzilla spinner. 'clang --version' returns: Apple LLVM version 7.3.0 (clang-703.0.31) Target: x86_64-apple-darwin15.6.0 Thread model: posix Cheers -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs