[cfe-commits] r48102 - /cfe/trunk/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Sun Mar 9 00:12:37 PST 2008


Author: kremenek
Date: Sun Mar  9 03:12:37 2008
New Revision: 48102

URL: http://llvm.org/viewvc/llvm-project?rev=48102&view=rev
Log:
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).

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=48102&r1=48101&r2=48102&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Sun Mar  9 03:12:37 2008
@@ -1162,21 +1162,13 @@
           }
           
           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 @@
           // 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;
           }
             





More information about the cfe-commits mailing list