Return UnknownVal for pointer arithmetic on struct fields.
llvm-svn: 73851
This commit is contained in:
parent
6ead59f8ed
commit
540c009fbe
|
@ -773,8 +773,13 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state,
|
|||
SVal ZeroIdx = ValMgr.makeZeroArrayIndex();
|
||||
ER = MRMgr.getElementRegion(EleTy, ZeroIdx, AR, getContext());
|
||||
}
|
||||
else
|
||||
else if (isa<FieldRegion>(MR)) {
|
||||
// Not track pointer arithmetic on struct fields.
|
||||
return UnknownVal();
|
||||
}
|
||||
else {
|
||||
ER = cast<ElementRegion>(MR);
|
||||
}
|
||||
|
||||
SVal Idx = ER->getIndex();
|
||||
|
||||
|
|
|
@ -8,3 +8,12 @@ void bar() {
|
|||
*(unsigned*)&y = foo();
|
||||
y.x = 1;
|
||||
}
|
||||
|
||||
struct s {
|
||||
int n;
|
||||
};
|
||||
|
||||
void f() {
|
||||
struct s a;
|
||||
int *p = &(a.n) + 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue