Merge pull request #11503 from ethereum/issue-11501

Fix crash in ControlFlowGraph related to free functions.
This commit is contained in:
chriseth 2021-06-09 12:24:03 +02:00 committed by GitHub
commit edee67b4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -141,11 +141,9 @@ public:
// containers using this struct // containers using this struct
bool operator<(FunctionContractTuple const& _other) const bool operator<(FunctionContractTuple const& _other) const
{ {
if (contract && _other.contract) return
if (contract->id() != _other.contract->id()) std::make_pair(contract ? contract->id() : -1, function->id()) <
return contract->id() < _other.contract->id(); std::make_pair(_other.contract ? _other.contract->id() : -1, _other.function->id());
return function->id() < _other.function->id();
} }
}; };
explicit CFG(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {} explicit CFG(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}

View File

@ -0,0 +1,14 @@
contract C0 {
function f() external {}
function f(int) external {}
function f2() external {}
}
function f() {}
contract C {
function f() external {}
}
contract C2 is C0 {}
// ----
// Warning 2519: (16-40): This declaration shadows an existing declaration.
// Warning 2519: (43-70): This declaration shadows an existing declaration.
// Warning 2519: (132-156): This declaration shadows an existing declaration.