diff options
author | chriseth <chris@ethereum.org> | 2017-10-06 01:31:17 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-11-22 10:35:34 +0800 |
commit | 8538a25f8d97f8416d20ace7dcd1bd760a425db9 (patch) | |
tree | e4a05c73c3dc1b4487b60a2db4bb070186ab0b09 /libsolidity/formal/SMTChecker.cpp | |
parent | 19d5c424295df9638b32a657b31463abac9eb000 (diff) | |
download | dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.tar dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.tar.gz dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.tar.bz2 dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.tar.lz dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.tar.xz dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.tar.zst dexon-solidity-8538a25f8d97f8416d20ace7dcd1bd760a425db9.zip |
Fix problem with non-value-typed variables.
Diffstat (limited to 'libsolidity/formal/SMTChecker.cpp')
-rw-r--r-- | libsolidity/formal/SMTChecker.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libsolidity/formal/SMTChecker.cpp b/libsolidity/formal/SMTChecker.cpp index 6c4662ac..1050621e 100644 --- a/libsolidity/formal/SMTChecker.cpp +++ b/libsolidity/formal/SMTChecker.cpp @@ -592,21 +592,17 @@ smt::CheckResult SMTChecker::checkSatisifable() void SMTChecker::initializeLocalVariables(FunctionDefinition const& _function) { for (auto const& variable: _function.localVariables()) - { - createVariable(*variable); - setZeroValue(*variable); - } + if (createVariable(*variable)) + setZeroValue(*variable); + for (auto const& param: _function.parameters()) - { - createVariable(*param); - setUnknownValue(*param); - } + if (createVariable(*param)) + setUnknownValue(*param); + if (_function.returnParameterList()) for (auto const& retParam: _function.returnParameters()) - { - createVariable(*retParam); - setZeroValue(*retParam); - } + if (createVariable(*retParam)) + setZeroValue(*retParam); } void SMTChecker::resetVariables(vector<Declaration const*> _variables) @@ -618,7 +614,7 @@ void SMTChecker::resetVariables(vector<Declaration const*> _variables) } } -void SMTChecker::createVariable(VariableDeclaration const& _varDecl) +bool SMTChecker::createVariable(VariableDeclaration const& _varDecl) { if (dynamic_cast<IntegerType const*>(_varDecl.type().get())) { @@ -628,12 +624,16 @@ void SMTChecker::createVariable(VariableDeclaration const& _varDecl) m_currentSequenceCounter[&_varDecl] = 0; m_nextFreeSequenceCounter[&_varDecl] = 1; m_variables.emplace(&_varDecl, m_interface->newFunction(uniqueSymbol(_varDecl), smt::Sort::Int, smt::Sort::Int)); + return true; } else + { m_errorReporter.warning( _varDecl.location(), "Assertion checker does not yet support the type of this variable." ); + return false; + } } string SMTChecker::uniqueSymbol(Declaration const& _decl) |