diff options
author | Anna Zaks <ganna@apple.com> | 2011-12-09 03:34:02 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-12-09 03:34:02 +0000 |
commit | 432a4558b8161c362efc319f8a38e074e74da201 (patch) | |
tree | ee0bbf442be115414da7089366e2f09b65453adb /lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | |
parent | 42786839cff1ccbe4d883b81d01846c5d774ffc6 (diff) |
[analyzer] Fix inconsistency on when SValBuilder assumes that 2
types are equivalent.
+ A taint test which tests bitwise operations and which was
triggering an assertion due to presence of the integer to integer cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp index 89d9dc0242..a7b67fbe8a 100644 --- a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp @@ -80,16 +80,14 @@ SVal SimpleSValBuilder::evalCastFromNonLoc(NonLoc val, QualType castTy) { if (const SymExpr *se = val.getAsSymbolicExpression()) { QualType T = Context.getCanonicalType(se->getType(Context)); - if (T == Context.getCanonicalType(castTy)) - return val; - + // If types are the same or both are integers, ignore the cast. // FIXME: Remove this hack when we support symbolic truncation/extension. // HACK: If both castTy and T are integers, ignore the cast. This is // not a permanent solution. Eventually we want to precisely handle // extension/truncation of symbolic integers. This prevents us from losing // precision when we assign 'x = y' and 'y' is symbolic and x and y are // different integer types. - if (T->isIntegerType() && castTy->isIntegerType()) + if (haveSameType(T, castTy)) return val; if (!isLocType) @@ -483,7 +481,7 @@ SVal SimpleSValBuilder::evalBinOpNN(const ProgramState *state, // Otherwise, make a SymbolVal out of the expression. return MakeSymIntVal(symIntExpr, op, rhsInt->getValue(), resultTy); - // LHS is a simple symbol. + // LHS is a simple symbol (not a symbolic expression). } else { nonloc::SymbolVal *slhs = cast<nonloc::SymbolVal>(&lhs); SymbolRef Sym = slhs->getSymbol(); |