Support multi-variable-declarations without value.

This commit is contained in:
Daniel Kirchner 2021-04-13 12:26:13 +02:00
parent 5dae888c00
commit 3a4769bd99
2 changed files with 32 additions and 5 deletions

View File

@ -213,11 +213,17 @@ void StackToMemoryMover::operator()(Block& _block)
else
return {};
}
FunctionCall const* functionCall = get_if<FunctionCall>(_stmt.value.get());
yulAssert(functionCall, "");
auto rhsMemorySlots = m_functionReturnVariables.at(functionCall->functionName.name) |
ranges::views::transform(m_memoryOffsetTracker) |
ranges::to<vector<optional<YulString>>>;
vector<optional<YulString>> rhsMemorySlots;
if (_stmt.value)
{
FunctionCall const* functionCall = get_if<FunctionCall>(_stmt.value.get());
yulAssert(functionCall, "");
rhsMemorySlots = m_functionReturnVariables.at(functionCall->functionName.name) |
ranges::views::transform(m_memoryOffsetTracker) |
ranges::to<vector<optional<YulString>>>;
}
else
rhsMemorySlots = vector<optional<YulString>>(_lhsVars.size(), nullopt);
// Nothing to do, if the right-hand-side remains entirely on the stack and
// none of the variables in the left-hand-side are moved.

View File

@ -0,0 +1,21 @@
{
mstore(0x40, memoryguard(0x60))
{
let x, y
}
{
let z, $w
}
}
// ----
// step: fakeStackLimitEvader
//
// {
// mstore(0x40, memoryguard(0x80))
// { let x, y }
// {
// let z_1, $w_2
// mstore(0x60, $w_2)
// let z := z_1
// }
// }