Fix accidental use of CheckSVal instead of CheckLocation, and add a
small test case to show we handle dereferences of undefined values. llvm-svn: 85492
This commit is contained in:
parent
98261735b4
commit
1dbdbcc04c
|
@ -763,7 +763,7 @@ class VISIBILITY_HIDDEN CheckUndefDeref : public Checker {
|
||||||
public:
|
public:
|
||||||
CheckUndefDeref() : BT(0) {}
|
CheckUndefDeref() : BT(0) {}
|
||||||
|
|
||||||
ExplodedNode *CheckSVal(const Stmt *S, ExplodedNode *Pred,
|
ExplodedNode *CheckLocation(const Stmt *S, ExplodedNode *Pred,
|
||||||
const GRState *state, SVal V, GRExprEngine &Eng);
|
const GRState *state, SVal V, GRExprEngine &Eng);
|
||||||
|
|
||||||
static void *getTag() {
|
static void *getTag() {
|
||||||
|
@ -772,7 +772,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ExplodedNode *CheckUndefDeref::CheckSVal(const Stmt *S, ExplodedNode *Pred,
|
ExplodedNode *CheckUndefDeref::CheckLocation(const Stmt *S, ExplodedNode *Pred,
|
||||||
const GRState *state, SVal V,
|
const GRState *state, SVal V,
|
||||||
GRExprEngine &Eng) {
|
GRExprEngine &Eng) {
|
||||||
GRStmtNodeBuilder &Builder = Eng.getBuilder();
|
GRStmtNodeBuilder &Builder = Eng.getBuilder();
|
||||||
|
|
|
@ -154,6 +154,12 @@ void handle_sizeof_void(unsigned flag) {
|
||||||
*p = 1; // no-warning
|
*p = 1; // no-warning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check deference of undefined values
|
||||||
|
void check_deref_undef(void) {
|
||||||
|
int *p;
|
||||||
|
*p = 0xDEADBEEF; // expected-warning{{Dereference of undefined pointer value}}
|
||||||
|
}
|
||||||
|
|
||||||
// PR 3422
|
// PR 3422
|
||||||
void pr3422_helper(char *p);
|
void pr3422_helper(char *p);
|
||||||
void pr3422() {
|
void pr3422() {
|
||||||
|
|
Loading…
Reference in New Issue