Fixed bug in the transfer function for dereferences: the loaded value from EvalLoad should bind to the UnaryOperator*, not its subexpression.
Added test case to exercise this fix when checking for uses of uninitialized values. Patch by Zhongxing Xu! llvm-svn: 51377
This commit is contained in:
parent
78d66e4ac1
commit
b120ff1b95
|
|
@ -1596,7 +1596,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred,
|
|||
if (asLVal)
|
||||
MakeNode(Dst, U, *I, SetRVal(St, U, location));
|
||||
else
|
||||
EvalLoad(Dst, Ex, *I, St, location);
|
||||
EvalLoad(Dst, U, *I, St, location);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -33,3 +33,11 @@ int f2_b() {
|
|||
return ((x+1)+2+((x))) + 1 ? 1 : 2; // expected-warning{{Branch}}
|
||||
}
|
||||
|
||||
int f3(void) {
|
||||
int i;
|
||||
int *p = &i;
|
||||
if (*p > 0) // expected-warning{{Branch condition evaluates to an uninitialized value}}
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue