From: Ted Kremenek Date: Sun, 9 Mar 2008 08:12:37 +0000 (+0000) Subject: Bug fix in the transfer function for compound assignments: if the value X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ce9214a9a7003ec7db15b917d15423f79cad556;p=clang 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48102 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index 95f406b9e0..de6e10cf3c 100644 --- a/Analysis/GRExprEngine.cpp +++ b/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(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(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(GetRVal(St, B))); Dst.Add(N2); continue; } if (RightV.isUnknown()) { - St = SetRVal(SetRVal(St, LeftLV, RightV), B, RightV); + assert (isa(GetRVal(St, B))); + St = SetRVal(St, LeftLV, UnknownVal()); break; }