diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-09 08:12:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-09 08:12:37 +0000 |
commit | cfd8b19ef734792f09cebe41f49d2d1de05bed08 (patch) | |
tree | 2a91474a9075644dc3f7eadf68641c5368cf307a | |
parent | c4c9dde04c350a8a953360dd0fdc2261ca66ad5f (diff) | |
download | bcm5719-llvm-cfd8b19ef734792f09cebe41f49d2d1de05bed08.tar.gz bcm5719-llvm-cfd8b19ef734792f09cebe41f49d2d1de05bed08.zip |
Bug fix in the transfer function for compound assignments: if the value
of the LHS expressions is Unknown, the value of the entire expression
does not evaluate to the RHS (as is the case with normal assignments).
llvm-svn: 48102
-rw-r--r-- | clang/Analysis/GRExprEngine.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/clang/Analysis/GRExprEngine.cpp b/clang/Analysis/GRExprEngine.cpp index 95f406b9e0a..de6e10cf3c6 100644 --- a/clang/Analysis/GRExprEngine.cpp +++ b/clang/Analysis/GRExprEngine.cpp @@ -1162,21 +1162,13 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, } if (LeftV.isUnknown()) { - - // While we do not know the location to store RightV, - // the entire expression does evaluate to RightV. - - if (RightV.isUnknown()) { - Dst.Add(N2); - continue; - } - - St = SetRVal(St, B, RightV); - break; + assert (isa<UnknownVal>(GetRVal(St, B))); + Dst.Add(N2); + continue; } // At this pointer we know that the LHS evaluates to an LVal - // that is neither "Unknown" or "Unintialized." + // that is neither "Unknown" or "Undefined." LVal LeftLV = cast<LVal>(LeftV); @@ -1196,12 +1188,16 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, // Propagate unknown values. if (V.isUnknown()) { + // The value bound to LeftV is unknown. Thus we just + // propagate the current node (as "B" is already bound to nothing). + assert (isa<UnknownVal>(GetRVal(St, B))); Dst.Add(N2); continue; } if (RightV.isUnknown()) { - St = SetRVal(SetRVal(St, LeftLV, RightV), B, RightV); + assert (isa<UnknownVal>(GetRVal(St, B))); + St = SetRVal(St, LeftLV, UnknownVal()); break; } |