No. I want to reduce the uses of StripCasts. It shouldn't be used everywhere. Here we should check the zero index explicitly.
On Sun, Nov 28, 2010 at 3:45 PM, Ted Kremenek <[email protected]> wrote: > Hi Zhongxing, > > What is the motivation for this change? Did the previous logic cause a > test case to fail? > > On Nov 26, 2010, at 1:07 AM, Zhongxing Xu <[email protected]> wrote: > > > Author: zhongxingxu > > Date: Fri Nov 26 03:07:38 2010 > > New Revision: 120177 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=120177&view=rev > > Log: > > Should not use StripCasts() in this context. > > > > Modified: > > cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp > > > > Modified: cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp > > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp?rev=120177&r1=120176&r2=120177&view=diff > > > ============================================================================== > > --- cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp (original) > > +++ cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp Fri Nov 26 > 03:07:38 2010 > > @@ -48,19 +48,16 @@ > > > > SVal V = state->getSVal(RetE); > > const MemRegion *R = V.getAsRegion(); > > - if (!R) > > - return; > > - > > - R = R->StripCasts(); > > - if (!R) > > - return; > > > > const ElementRegion *ER = dyn_cast_or_null<ElementRegion>(R); > > if (!ER) > > return; > > > > DefinedOrUnknownSVal Idx = cast<DefinedOrUnknownSVal>(ER->getIndex()); > > - > > + // Zero index is always in bound, this also passes ElementRegions > created for > > + // pointer casts. > > + if (Idx.isZeroConstant()) > > + return; > > // FIXME: All of this out-of-bounds checking should eventually be > refactored > > // into a common place. > > > > > > > > _______________________________________________ > > cfe-commits mailing list > > [email protected] > > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
