Handle loading of field	values from LazyCompoundVals in	GRExprEngine::VisitMemberExpr().
This fixes the crash reported in PR 5316.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85578 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index c0aed23..99e2144 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1092,13 +1092,26 @@
     // FIXME: Should we insert some assumption logic in here to determine
     // if "Base" is a valid piece of memory?  Before we put this assumption
     // later when using FieldOffset lvals (which we no longer have).
-    SVal L = state->getLValue(Field, state->getSVal(Base));
+    SVal BaseV = state->getSVal(Base);
+    
+    if (nonloc::LazyCompoundVal *LVC=dyn_cast<nonloc::LazyCompoundVal>(&BaseV)){
+      const LazyCompoundValData *D = LVC->getCVData();
+      const FieldRegion * FR =
+        getStateManager().getRegionManager().getFieldRegion(Field,
+                                                            D->getRegion());
 
-    if (asLValue)
-      MakeNode(Dst, M, *I, state->BindExpr(M, L),
-               ProgramPoint::PostLValueKind);
-    else
-      EvalLoad(Dst, M, *I, state, L);
+      SVal V = D->getState()->getSVal(loc::MemRegionVal(FR));
+      MakeNode(Dst, M, *I, state->BindExpr(M, V));
+    }
+    else {
+      SVal L = state->getLValue(Field, BaseV);
+
+      if (asLValue)
+        MakeNode(Dst, M, *I, state->BindExpr(M, L),
+                 ProgramPoint::PostLValueKind);
+      else
+        EvalLoad(Dst, M, *I, state, L);
+    }
   }
 }