mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix inline assembly stack warnings when using variables
This commit is contained in:
parent
58e75c7a48
commit
dad33f80dd
@ -7,6 +7,7 @@ Features:
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Inline assembly: calculate stack height warning correctly even when local variables are used.
|
||||
* Parser: disallow empty enum definitions.
|
||||
* Type checker: disallow conversion between different enum types.
|
||||
|
||||
|
@ -216,10 +216,18 @@ public:
|
||||
size_t numVariables = m_state.variables.size();
|
||||
int deposit = m_state.assembly.deposit();
|
||||
std::for_each(_block.statements.begin(), _block.statements.end(), boost::apply_visitor(*this));
|
||||
deposit = m_state.assembly.deposit() - deposit;
|
||||
|
||||
// pop variables
|
||||
while (m_state.variables.size() > numVariables)
|
||||
{
|
||||
m_state.assembly.append(solidity::Instruction::POP);
|
||||
m_state.variables.pop_back();
|
||||
}
|
||||
|
||||
m_state.assembly.setSourceLocation(_block.location);
|
||||
|
||||
deposit = m_state.assembly.deposit() - deposit;
|
||||
|
||||
// issue warnings for stack height discrepancies
|
||||
if (deposit < 0)
|
||||
{
|
||||
@ -238,12 +246,6 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
// pop variables
|
||||
while (m_state.variables.size() > numVariables)
|
||||
{
|
||||
m_state.assembly.append(solidity::Instruction::POP);
|
||||
m_state.variables.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user