[cfe-commits] r81820 - in /cfe/trunk: lib/Analysis/GRExprEngine.cpp test/Analysis/misc-ps.m test/Analysis/retain-release.m
Eli Friedman
eli.friedman at gmail.com
Mon Sep 14 19:54:15 PDT 2009
On Mon, Sep 14, 2009 at 5:40 PM, Ted Kremenek <kremenek at apple.com> wrote:
> --- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
> +++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Mon Sep 14 19:40:32 2009
> @@ -2430,10 +2430,15 @@
> return;
> }
>
> - // FIXME: Just report "Unknown" for OffsetOf.
> - case UnaryOperator::OffsetOf:
> - Dst.Add(Pred);
> + case UnaryOperator::OffsetOf: {
> + const APSInt &IV = U->EvaluateAsInt(getContext());
> + assert(IV.getBitWidth() == getContext().getTypeSize(U->getType()));
> + assert(U->getType()->isIntegerType());
> + assert(IV.isSigned() == U->getType()->isSignedIntegerType());
> + SVal X = ValMgr.makeIntVal(IV);
> + MakeNode(Dst, U, Pred, GetState(Pred)->BindExpr(U, X));
> return;
> + }
This looks suspicious; the result of __builtin_offsetof isn't
necessarily an integer constant.
-Eli
More information about the cfe-commits
mailing list