]> granicus.if.org Git - clang/commitdiff
Temporarily disable out-of-bounds checking. The current checking logic will not...
authorTed Kremenek <kremenek@apple.com>
Sat, 1 Aug 2009 05:59:39 +0000 (05:59 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 1 Aug 2009 05:59:39 +0000 (05:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77779 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/GRExprEngine.cpp
test/Analysis/outofbound.c
test/Analysis/rdar-6541136-region.c

index 6431ec7ace6872d5f733afa9d5035415e359f65a..14333875f8b44015fdf629a03d79801a0732ae2d 100644 (file)
@@ -1241,6 +1241,9 @@ GRExprEngine::NodeTy* GRExprEngine::EvalLocation(Stmt* Ex, NodeTy* Pred,
   if (!StNotNull)
     return NULL;
 
+  // FIXME: Temporarily disable out-of-bounds checking until we make
+  // the logic reflect recent changes to CastRegion and friends.
+#if 0
   // Check for out-of-bound array access.
   if (isa<loc::MemRegionVal>(LV)) {
     const MemRegion* R = cast<loc::MemRegionVal>(LV).getRegion();
@@ -1278,6 +1281,7 @@ GRExprEngine::NodeTy* GRExprEngine::EvalLocation(Stmt* Ex, NodeTy* Pred,
       StNotNull = StInBound;
     }
   }
+#endif
   
   // Generate a new node indicating the checks succeed.
   return Builder->generateNode(Ex, StNotNull, Pred,
@@ -1316,7 +1320,8 @@ static bool EvalOSAtomicCompareAndSwap(ExplodedNodeSet<GRState>& Dst,
     return false;
   
   Expr *theValueExpr = CE->getArg(2);
-  const PointerType *theValueType = theValueExpr->getType()->getAs<PointerType>();
+  const PointerType *theValueType =
+    theValueExpr->getType()->getAs<PointerType>();
   
   // theValueType not a pointer?
   if (!theValueType)
index 527a311d2b7dd9c8680dc12a619908fea0a0af99..568f14329e9b8efc986466f5b5d0b1a299807b54 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s
+// XFAIL
 
 char f1() {
   char* s = "abcd";
index 1e7a2d974bc4d34b0e28dfbc6deb905d16c5bc76..e2779e8d914f9b235f1c90c95a27b8c90715bb3c 100644 (file)
@@ -13,7 +13,10 @@ void foo( void )
   struct load_wine *cmd = (void*) &wonky[1];
   cmd = cmd;
   char *p = (void*) &wonky[1];
-  *p = 1; 
+  *p = 1;  // no-warning
   kernel_tea_cheese_t *q = &wonky[1];
-  kernel_tea_cheese_t r = *q; // expected-warning{{out-of-bound memory position}}
+  // This test case tests both the RegionStore logic (doesn't crash) and
+  // the out-of-bounds checking.  We don't expect the warning for now since
+  // out-of-bound checking is temporarily disabled.
+  kernel_tea_cheese_t r = *q; // eventually-warning{{out-of-bound memory position}}
 }