From: Argyrios Kyrtzidis Date: Fri, 18 Feb 2011 20:55:19 +0000 (+0000) Subject: [analyzer] Fix a crash when analyzing C++ code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4699d14b03d805ad9ccaa6288836ac2a8612925;p=clang [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 --- 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); +}