From eb01ba670e80e267bf28beb8a0888a0bcf87734a Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 1 Aug 2009 05:59:39 +0000 Subject: [PATCH] Temporarily disable out-of-bounds checking. The current checking logic will not work quite right with the changes I'm about to commit. llvm-svn: 77779 --- clang/lib/Analysis/GRExprEngine.cpp | 7 ++++++- clang/test/Analysis/outofbound.c | 1 + clang/test/Analysis/rdar-6541136-region.c | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index 6431ec7..1433387 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -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(LV)) { const MemRegion* R = cast(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& Dst, return false; Expr *theValueExpr = CE->getArg(2); - const PointerType *theValueType = theValueExpr->getType()->getAs(); + const PointerType *theValueType = + theValueExpr->getType()->getAs(); // theValueType not a pointer? if (!theValueType) diff --git a/clang/test/Analysis/outofbound.c b/clang/test/Analysis/outofbound.c index 527a311..568f143 100644 --- a/clang/test/Analysis/outofbound.c +++ b/clang/test/Analysis/outofbound.c @@ -1,4 +1,5 @@ // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// XFAIL char f1() { char* s = "abcd"; diff --git a/clang/test/Analysis/rdar-6541136-region.c b/clang/test/Analysis/rdar-6541136-region.c index 1e7a2d9..e2779e8 100644 --- a/clang/test/Analysis/rdar-6541136-region.c +++ b/clang/test/Analysis/rdar-6541136-region.c @@ -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}} } -- 2.7.4