aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-11-15 20:09:42 +0000
committerTed Kremenek <kremenek@apple.com>2010-11-15 20:09:42 +0000
commit948163b4986dfb5060c0dbd2e5910431640e56d1 (patch)
tree81883c3308baaa7524e656ff3a98eebc9619efe5 /lib
parent2715b207a6a22970441da162313e1729d54dc24e (diff)
Relax assertion in SValuator so that we don't crash when analyzing a call via a function pointer that
casts the return value to something completely different. While we need better reasoning here, we should definately not crash. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Checker/SValuator.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Checker/SValuator.cpp b/lib/Checker/SValuator.cpp
index 273e5742a8..a3bdcd7762 100644
--- a/lib/Checker/SValuator.cpp
+++ b/lib/Checker/SValuator.cpp
@@ -122,7 +122,18 @@ SVal SValuator::EvalCast(SVal val, QualType castTy, QualType originalTy) {
// FIXME: We should handle the case where we strip off view layers to get
// to a desugared type.
- assert(Loc::IsLocType(castTy));
+ if (!Loc::IsLocType(castTy)) {
+ // FIXME: There can be gross cases where one casts the result of a function
+ // (that returns a pointer) to some other value that happens to fit
+ // within that pointer value. We currently have no good way to
+ // model such operations. When this happens, the underlying operation
+ // is that the caller is reasoning about bits. Conceptually we are
+ // layering a "view" of a location on top of those bits. Perhaps
+ // we need to be more lazy about mutual possible views, even on an
+ // SVal? This may be necessary for bit-level reasoning as well.
+ return UnknownVal();
+ }
+
// We get a symbolic function pointer for a dereference of a function
// pointer, but it is of function type. Example: