From: Ted Kremenek Date: Wed, 16 Jul 2008 00:23:49 +0000 (+0000) Subject: Fix regression introduced by http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd512dce55a8e45e82e92f7888803a71e72c1045;p=clang Fix regression introduced by http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080714/006514.html. The regression was the casts from integers to pointers where not being handled: they would just return UnknownVal. This would greatly decrease path-sensitivity. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53659 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp index 562e5794b2..e3ba0f3c4a 100644 --- a/lib/Analysis/GRSimpleVals.cpp +++ b/lib/Analysis/GRSimpleVals.cpp @@ -377,8 +377,10 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) { if (!isa(X)) return UnknownVal(); + bool isLValType = LVal::IsLValType(T); + // Only handle casts from integers to integers. - if (!T->isIntegerType()) + if (!isLValType && !T->isIntegerType()) return UnknownVal(); BasicValueFactory& BasicVals = Eng.getBasicVals(); @@ -387,7 +389,7 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) { V.setIsUnsigned(T->isUnsignedIntegerType() || LVal::IsLValType(T)); V.extOrTrunc(Eng.getContext().getTypeSize(T)); - if (LVal::IsLValType(T)) + if (isLValType) return lval::ConcreteInt(BasicVals.getValue(V)); else return nonlval::ConcreteInt(BasicVals.getValue(V));