Invalidate old subexpression bindings when binding UnknownVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50466 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index a7b31d5..d9a2313 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -157,7 +157,7 @@
return St;
}
- return StateMgr.SetRVal(St, Ex, V, isBlkExpr, false);
+ return StateMgr.SetRVal(St, Ex, V, isBlkExpr, true);
}
//===----------------------------------------------------------------------===//
@@ -890,8 +890,12 @@
// FIXME: The "CheckOnly" option exists only because Array and Field
// loads aren't fully implemented. Eventually this option will go away.
- if (location.isUnknown() || CheckOnly)
+ if (CheckOnly)
MakeNode(Dst, Ex, Pred, St);
+ else if (location.isUnknown()) {
+ // This is important. We must nuke the old binding.
+ MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, UnknownVal()));
+ }
else
MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, GetRVal(St, cast<LVal>(location),
Ex->getType())));
@@ -1593,7 +1597,7 @@
St = SetRVal(St, U, U->isPostfix() ? V2 : Result);
// Perform the store.
- EvalStore(Dst, U, *I, St, V1, Result);
+ EvalStore(Dst, U, *I2, St, V1, Result);
}
}
}