Fix pr6035.

llvm-svn: 93422
This commit is contained in:
Zhongxing Xu 2010-01-14 03:45:06 +00:00
parent 200c99dd1e
commit 803ade2532
2 changed files with 14 additions and 0 deletions

View File

@ -66,6 +66,9 @@ SValuator::CastResult SValuator::EvalCast(SVal val, const GRState *state,
if (C.hasSameUnqualifiedType(castTy, originalTy))
return CastResult(state, val);
if (castTy->isIntegerType() && originalTy->isIntegerType())
return CastResult(state, EvalCastNL(cast<NonLoc>(val), castTy));
// Check for casts from pointers to integers.
if (castTy->isIntegerType() && Loc::IsLocType(originalTy))
return CastResult(state, EvalCastL(cast<Loc>(val), castTy));

View File

@ -57,3 +57,14 @@ void doit(char *data, int len) {
memcpy(buf, data, len);
}
}
struct pcm_feeder {
void *data;
};
// Test cast a pointer to long and then to int does not crash SValuator.
void feed_swaplr (struct pcm_feeder *f)
{
int bps;
bps = (long) f->data;
(void) bps;
}