mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix IR bug: constructor parameter that needs multiple stack slots
When an argument had multiple stack slots, like `function() external`, there wasn't enough variables assigned for the constructor. This lead to some mismatch between return values and arguments between some functions.
This commit is contained in:
parent
b385b41fa0
commit
0135cae222
@ -4255,7 +4255,7 @@ string YulUtilFunctions::copyConstructorArgumentsToMemoryFunction(
|
|||||||
toString(_contract.id());
|
toString(_contract.id());
|
||||||
|
|
||||||
return m_functionCollector.createFunction(functionName, [&]() {
|
return m_functionCollector.createFunction(functionName, [&]() {
|
||||||
string returnParams = suffixedVariableNameList("ret_param_",0, _contract.constructor()->parameters().size());
|
string returnParams = suffixedVariableNameList("ret_param_",0, CompilerUtils::sizeOnStack(_contract.constructor()->parameters()));
|
||||||
ABIFunctions abiFunctions(m_evmVersion, m_revertStrings, m_functionCollector);
|
ABIFunctions abiFunctions(m_evmVersion, m_revertStrings, m_functionCollector);
|
||||||
|
|
||||||
return util::Whiskers(R"(
|
return util::Whiskers(R"(
|
||||||
|
@ -129,7 +129,7 @@ string IRGenerator::generate(
|
|||||||
vector<string> constructorParams;
|
vector<string> constructorParams;
|
||||||
if (constructor && !constructor->parameters().empty())
|
if (constructor && !constructor->parameters().empty())
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < constructor->parameters().size(); ++i)
|
for (size_t i = 0; i < CompilerUtils::sizeOnStack(constructor->parameters()); ++i)
|
||||||
constructorParams.emplace_back(m_context.newYulVariable());
|
constructorParams.emplace_back(m_context.newYulVariable());
|
||||||
t(
|
t(
|
||||||
"copyConstructorArguments",
|
"copyConstructorArguments",
|
||||||
|
Loading…
Reference in New Issue
Block a user