[cfe-commits] r93422 - in /cfe/trunk: lib/Analysis/SValuator.cpp test/Analysis/casts.c
Zhongxing Xu
xuzhongxing at gmail.com
Wed Jan 13 19:45:06 PST 2010
Author: zhongxingxu
Date: Wed Jan 13 21:45:06 2010
New Revision: 93422
URL: http://llvm.org/viewvc/llvm-project?rev=93422&view=rev
Log:
Fix pr6035.
Modified:
cfe/trunk/lib/Analysis/SValuator.cpp
cfe/trunk/test/Analysis/casts.c
Modified: cfe/trunk/lib/Analysis/SValuator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/SValuator.cpp?rev=93422&r1=93421&r2=93422&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/SValuator.cpp (original)
+++ cfe/trunk/lib/Analysis/SValuator.cpp Wed Jan 13 21:45:06 2010
@@ -66,6 +66,9 @@
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));
Modified: cfe/trunk/test/Analysis/casts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/casts.c?rev=93422&r1=93421&r2=93422&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/casts.c (original)
+++ cfe/trunk/test/Analysis/casts.c Wed Jan 13 21:45:06 2010
@@ -57,3 +57,14 @@
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;
+}
More information about the cfe-commits
mailing list