aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-18 20:55:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-18 20:55:19 +0000
commitf4699d14b03d805ad9ccaa6288836ac2a8612925 (patch)
tree8c5c729ef92200381ad875e9453ceb494d9c4159
parent16f744beaaa30bf3847740ca8e8beb6f0d3a0b93 (diff)
[analyzer] Fix a crash when analyzing C++ code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125958 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h2
-rw-r--r--test/Analysis/cxx-crashes.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
index 02517e38b4..a4327e127f 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -164,7 +164,7 @@ public:
}
inline const llvm::APSInt& getTruthValue(bool b) {
- return getTruthValue(b, Ctx.IntTy);
+ return getTruthValue(b, Ctx.getLogicalOperationType());
}
const CompoundValData *getCompoundValData(QualType T,
diff --git a/test/Analysis/cxx-crashes.cpp b/test/Analysis/cxx-crashes.cpp
new file mode 100644
index 0000000000..720850cc5c
--- /dev/null
+++ b/test/Analysis/cxx-crashes.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -verify %s
+
+int f1(char *dst) {
+ char *p = dst + 4;
+ char *q = dst + 3;
+ return !(q >= p);
+}