diff options
Diffstat (limited to 'clang/lib/Analysis')
| -rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index d9117f5930e..6bc70d5925c 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -1110,6 +1110,19 @@ void GRExprEngine::EvalLoad(NodeSet& Dst, Expr* Ex, NodeTy* Pred,    }    else {      SVal V = state->getSVal(cast<Loc>(location), Ex->getType()); +     +    // Casts can create weird scenarios where a location must be implicitly +    // converted to something else.  For example: +    // +    //  void *x; +    //  int *y = (int*) &x; // void** -> int* cast. +    //  invalidate(y);  // 'x' now binds to a symbolic region +    //  int z = *y; +    //     +    if (isa<Loc>(V) && !Loc::IsLocType(Ex->getType())) { +      V = EvalCast(V, Ex->getType()); +    } +          MakeNode(Dst, Ex, Pred, state->bindExpr(Ex, V), K, tag);    }  } | 

