mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-17 18:56:04 +00:00
Handle loading of field values from LazyCompoundVals in GRExprEngine::VisitMemberExpr().
This fixes the crash reported in PR 5316. llvm-svn: 85578
This commit is contained in:
parent
1cf0b03064
commit
e96a30a531
@ -1092,7 +1092,19 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, ExplodedNode* Pred,
|
|||||||
// FIXME: Should we insert some assumption logic in here to determine
|
// FIXME: Should we insert some assumption logic in here to determine
|
||||||
// if "Base" is a valid piece of memory? Before we put this assumption
|
// if "Base" is a valid piece of memory? Before we put this assumption
|
||||||
// later when using FieldOffset lvals (which we no longer have).
|
// 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());
|
||||||
|
|
||||||
|
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)
|
if (asLValue)
|
||||||
MakeNode(Dst, M, *I, state->BindExpr(M, L),
|
MakeNode(Dst, M, *I, state->BindExpr(M, L),
|
||||||
@ -1101,6 +1113,7 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, ExplodedNode* Pred,
|
|||||||
EvalLoad(Dst, M, *I, state, L);
|
EvalLoad(Dst, M, *I, state, L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// EvalBind - Handle the semantics of binding a value to a specific location.
|
/// EvalBind - Handle the semantics of binding a value to a specific location.
|
||||||
/// This method is used by EvalStore and (soon) VisitDeclStmt, and others.
|
/// This method is used by EvalStore and (soon) VisitDeclStmt, and others.
|
||||||
|
@ -415,3 +415,19 @@ int rdar7347252(rdar7347252_SSL1 *s) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// PR 5316 - "crash when accessing field of lazy compound value"
|
||||||
|
// Previously this caused a crash at the MemberExpr '.chr' when loading
|
||||||
|
// a field value from a LazyCompoundVal
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
typedef unsigned int pr5316_wint_t;
|
||||||
|
typedef pr5316_wint_t pr5316_REFRESH_CHAR;
|
||||||
|
typedef struct {
|
||||||
|
pr5316_REFRESH_CHAR chr;
|
||||||
|
}
|
||||||
|
pr5316_REFRESH_ELEMENT;
|
||||||
|
static void pr5316(pr5316_REFRESH_ELEMENT *dst, const pr5316_REFRESH_ELEMENT *src) {
|
||||||
|
while ((*dst++ = *src++).chr != L'\0') ;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user