
A clang user pointed out that messages for the static analyzer undefined assignment checker use the term ‘garbage’, which might have a negative connotation to some users. This change updates the messages to use the term ‘uninitialized’. This is the usual reason why a value is undefined in the static analyzer and describes the logical error that a programmer should take action to fix. Out-of-bounds reads can also produce undefined values in the static analyzer. The right long-term design is to have to the array bounds checker cover out-of-bounds reads, so we do not cover that case in the updated messages. The recent improvements to the array bounds checker make it a candidate to add to the core set of checkers. rdar://133418644
29 lines
471 B
C++
29 lines
471 B
C++
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
|
|
|
|
#include "Inputs/system-header-simulator-cxx.h"
|
|
|
|
struct Test {
|
|
Test() {}
|
|
~Test();
|
|
};
|
|
|
|
int foo() {
|
|
struct a {
|
|
// The dtor invocation of 'b' and 'c' used to create
|
|
// a loop in the egraph and the analysis stopped after
|
|
// this point.
|
|
Test b, c;
|
|
} d;
|
|
return 1;
|
|
}
|
|
|
|
int main() {
|
|
if (foo()) {
|
|
}
|
|
|
|
int x;
|
|
int y = x;
|
|
// expected-warning@-1{{Assigned value is uninitialized}}
|
|
(void)y;
|
|
}
|