aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-11-15 18:25:12 +0800
committerGitHub <noreply@github.com>2016-11-15 18:25:12 +0800
commit028ab1fbfbe7d83cb5fbf4be9e2eb29a22d5b687 (patch)
treebfa5124e20eda18203314d25ce6db711ad1c6e25 /libsolidity
parentc1b1efafdb30f11c9482e3ba95c5321790762215 (diff)
parentdce80911e198fe5d6317a9a4d155f929789fdea6 (diff)
downloaddexon-solidity-028ab1fbfbe7d83cb5fbf4be9e2eb29a22d5b687.tar.gz
dexon-solidity-028ab1fbfbe7d83cb5fbf4be9e2eb29a22d5b687.tar.zst
dexon-solidity-028ab1fbfbe7d83cb5fbf4be9e2eb29a22d5b687.zip
Merge pull request #1375 from ethereum/inline-assembly-stack-height
Fix inline assembly stack warnings when using variables
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/inlineasm/AsmCodeGen.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp
index 5d920cb7..76c71048 100644
--- a/libsolidity/inlineasm/AsmCodeGen.cpp
+++ b/libsolidity/inlineasm/AsmCodeGen.cpp
@@ -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: