diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-22 20:55:28 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-22 20:55:28 +0800 |
commit | f2d6226718a226ae4764bd7d1379c6e50c7f269a (patch) | |
tree | 8e5988ff12f610689fc25f4650ca7e758361384a | |
parent | f38429fef88b644e9c54c1bf2a1abe754dbd324d (diff) | |
download | dexon-solidity-f2d6226718a226ae4764bd7d1379c6e50c7f269a.tar.gz dexon-solidity-f2d6226718a226ae4764bd7d1379c6e50c7f269a.tar.zst dexon-solidity-f2d6226718a226ae4764bd7d1379c6e50c7f269a.zip |
Some smaller issues found by Covertiy Scan
-rw-r--r-- | libevmasm/CommonSubexpressionEliminator.cpp | 1 | ||||
-rw-r--r-- | libevmasm/CommonSubexpressionEliminator.h | 2 | ||||
-rw-r--r-- | libsolidity/ast/AST.cpp | 1 | ||||
-rw-r--r-- | libsolidity/ast/Types.cpp | 8 |
4 files changed, 6 insertions, 6 deletions
diff --git a/libevmasm/CommonSubexpressionEliminator.cpp b/libevmasm/CommonSubexpressionEliminator.cpp index 70324e7f..293cb02c 100644 --- a/libevmasm/CommonSubexpressionEliminator.cpp +++ b/libevmasm/CommonSubexpressionEliminator.cpp @@ -220,6 +220,7 @@ void CSECodeGenerator::addDependencies(Id _c) if (m_neededBy.count(_c)) return; // we already computed the dependencies for _c ExpressionClasses::Expression expr = m_expressionClasses.representative(_c); + assertThrow(expr.item, OptimizerException, ""); if (expr.item->type() == UndefinedItem) BOOST_THROW_EXCEPTION( // If this exception happens, we need to find a different way to generate the diff --git a/libevmasm/CommonSubexpressionEliminator.h b/libevmasm/CommonSubexpressionEliminator.h index f2473200..0b957a0e 100644 --- a/libevmasm/CommonSubexpressionEliminator.h +++ b/libevmasm/CommonSubexpressionEliminator.h @@ -147,7 +147,7 @@ private: AssemblyItems m_generatedItems; /// Current height of the stack relative to the start. - int m_stackHeight; + int m_stackHeight = 0; /// If (b, a) is in m_requests then b is needed to compute a. std::multimap<Id, Id> m_neededBy; /// Current content of the stack. diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index e173237e..605daf55 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -188,7 +188,6 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::inter { if (!m_interfaceFunctionList) { - set<string> functionsSeen; set<string> signaturesSeen; m_interfaceFunctionList.reset(new vector<pair<FixedHash<4>, FunctionTypePointer>>()); for (ContractDefinition const* contract: annotation().linearizedBaseContracts) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index adf41229..5e61cdee 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -739,18 +739,18 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const { if (_convertTo.category() == Category::Integer) { - auto targetType = dynamic_cast<IntegerType const*>(&_convertTo); if (m_value == rational(0)) return true; if (isFractional()) return false; - int forSignBit = (targetType->isSigned() ? 1 : 0); + IntegerType const& targetType = dynamic_cast<IntegerType const&>(_convertTo); + int forSignBit = (targetType.isSigned() ? 1 : 0); if (m_value > rational(0)) { - if (m_value.numerator() <= (u256(-1) >> (256 - targetType->numBits() + forSignBit))) + if (m_value.numerator() <= (u256(-1) >> (256 - targetType.numBits() + forSignBit))) return true; } - else if (targetType->isSigned() && -m_value.numerator() <= (u256(1) << (targetType->numBits() - forSignBit))) + else if (targetType.isSigned() && -m_value.numerator() <= (u256(1) << (targetType.numBits() - forSignBit))) return true; return false; } |