[cfe-commits] r125958 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h test/Analysis/cxx-crashes.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Feb 18 12:55:20 PST 2011


Author: akirtzidis
Date: Fri Feb 18 14:55:19 2011
New Revision: 125958

URL: http://llvm.org/viewvc/llvm-project?rev=125958&view=rev
Log:
[analyzer] Fix a crash when analyzing C++ code.

Added:
    cfe/trunk/test/Analysis/cxx-crashes.cpp
Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h?rev=125958&r1=125957&r2=125958&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h Fri Feb 18 14:55:19 2011
@@ -164,7 +164,7 @@
   }
 
   inline const llvm::APSInt& getTruthValue(bool b) {
-    return getTruthValue(b, Ctx.IntTy);
+    return getTruthValue(b, Ctx.getLogicalOperationType());
   }
 
   const CompoundValData *getCompoundValData(QualType T,

Added: cfe/trunk/test/Analysis/cxx-crashes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cxx-crashes.cpp?rev=125958&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/cxx-crashes.cpp (added)
+++ cfe/trunk/test/Analysis/cxx-crashes.cpp Fri Feb 18 14:55:19 2011
@@ -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);
+}





More information about the cfe-commits mailing list