Fix SMTChecker bug when a public library function is called internally by an internal library function, which in turn is called internally by a contract.

This commit is contained in:
Leo Alt
2022-11-28 13:07:18 +01:00
parent 40f0329baa
commit 9a8dd4242f
6 changed files with 66 additions and 5 deletions
+8 -1
View File
@@ -1172,7 +1172,14 @@ void CHC::defineInterfacesAndSummaries(SourceUnit const& _source)
m_summaries[contract].emplace(function, createSummaryBlock(*function, *contract));
if (!function->isConstructor() && function->isPublic() && resolved.count(function))
if (
!function->isConstructor() &&
function->isPublic() &&
// Public library functions should have interfaces only for the libraries
// they're declared in.
(!function->libraryFunction() || (function->scope() == contract)) &&
resolved.count(function)
)
{
m_externalSummaries[contract].emplace(function, createSummaryBlock(*function, *contract));
+3 -4
View File
@@ -3162,11 +3162,10 @@ void SMTEncoder::collectFreeFunctions(set<SourceUnit const*, ASTNode::CompareByI
auto contract = dynamic_cast<ContractDefinition const*>(node.get());
contract && contract->isLibrary()
)
{
for (auto function: contract->definedFunctions())
if (!function->isPublic())
m_freeFunctions.insert(function);
}
// We need to add public library functions too because they can be called
// internally by internal library functions that are considered free functions.
m_freeFunctions.insert(function);
}
void SMTEncoder::createFreeConstants(set<SourceUnit const*, ASTNode::CompareByID> const& _sources)