[cfe-commits] r77779 - in /cfe/trunk: lib/Analysis/GRExprEngine.cpp test/Analysis/outofbound.c test/Analysis/rdar-6541136-region.c

Ted Kremenek kremenek at apple.com
Fri Jul 31 22:59:39 PDT 2009


Author: kremenek
Date: Sat Aug  1 00:59:39 2009
New Revision: 77779

URL: http://llvm.org/viewvc/llvm-project?rev=77779&view=rev
Log:
Temporarily disable out-of-bounds checking.  The current checking logic will not work quite right with the changes I'm about to commit.

Modified:
    cfe/trunk/lib/Analysis/GRExprEngine.cpp
    cfe/trunk/test/Analysis/outofbound.c
    cfe/trunk/test/Analysis/rdar-6541136-region.c

Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=77779&r1=77778&r2=77779&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Sat Aug  1 00:59:39 2009
@@ -1241,6 +1241,9 @@
   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 @@
       StNotNull = StInBound;
     }
   }
+#endif
   
   // Generate a new node indicating the checks succeed.
   return Builder->generateNode(Ex, StNotNull, Pred,
@@ -1316,7 +1320,8 @@
     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)

Modified: cfe/trunk/test/Analysis/outofbound.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/outofbound.c?rev=77779&r1=77778&r2=77779&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/outofbound.c (original)
+++ cfe/trunk/test/Analysis/outofbound.c Sat Aug  1 00:59:39 2009
@@ -1,4 +1,5 @@
 // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s
+// XFAIL
 
 char f1() {
   char* s = "abcd";

Modified: cfe/trunk/test/Analysis/rdar-6541136-region.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/rdar-6541136-region.c?rev=77779&r1=77778&r2=77779&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/rdar-6541136-region.c (original)
+++ cfe/trunk/test/Analysis/rdar-6541136-region.c Sat Aug  1 00:59:39 2009
@@ -13,7 +13,10 @@
   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}}
 }





More information about the cfe-commits mailing list