diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-12-09 08:32:57 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-12-09 08:32:57 +0000 |
commit | 1d153328be1c52cf8d595bbd24ca829c2f8334d2 (patch) | |
tree | 7ecc46f8dbcb10e5b0cd6e63536275c135a36c31 /clang/lib/Analysis/GRExprEngine.cpp | |
parent | f92d732c99534c23e8657de5feca373dc40937c5 (diff) | |
download | bcm5719-llvm-1d153328be1c52cf8d595bbd24ca829c2f8334d2.tar.gz bcm5719-llvm-1d153328be1c52cf8d595bbd24ca829c2f8334d2.zip |
OSAtomic simulation: use the original region as the location to load from,
instead of the ElementRegion obtained from casts.
Test cast: the leak cannot occur bacause the true branch cannot be taken.
llvm-svn: 90964
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index 4a960c69379..daa249f901c 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -1483,10 +1483,13 @@ static bool EvalOSAtomicCompareAndSwap(ExplodedNodeSet& Dst, ExplodedNodeSet Tmp; SVal location = state->getSVal(theValueExpr); // Here we should use the value type of the region as the load type. - const MemRegion *R = location.getAsRegion(); + const MemRegion *R = location.getAsRegion()->StripCasts(); QualType LoadTy; - if (R) + if (R) { LoadTy = cast<TypedRegion>(R)->getValueType(C); + // Use the region as the real load location. + location = loc::MemRegionVal(R); + } Engine.EvalLoad(Tmp, theValueExpr, Pred, state, location, OSAtomicLoadTag, LoadTy); |