[cfe-commits] r120177 - /cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp
Ted Kremenek
kremenek at apple.com
Sat Nov 27 23:45:45 PST 2010
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 <xuzhongxing at gmail.com> 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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list