aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-04-25 18:56:34 +0800
committerchriseth <chris@ethereum.org>2017-04-25 22:49:04 +0800
commite841b23bfd57607511d620ed34ef96188bbadec6 (patch)
treec712c8de09583baaaf2a52cd2d465d3d82088bff /libsolidity/codegen
parent3df7b064644d4f17572b82283c4f017e98041b17 (diff)
downloaddexon-solidity-e841b23bfd57607511d620ed34ef96188bbadec6.tar.gz
dexon-solidity-e841b23bfd57607511d620ed34ef96188bbadec6.tar.zst
dexon-solidity-e841b23bfd57607511d620ed34ef96188bbadec6.zip
Special case for storage types with offset zero.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp
index 1794cc23..6cff9d0b 100644
--- a/libsolidity/codegen/ContractCompiler.cpp
+++ b/libsolidity/codegen/ContractCompiler.cpp
@@ -573,9 +573,24 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
int stackDiff = _assembly.deposit() - m_context.baseStackOffsetOfVariable(*variable);
if (ref->second.isSlot || ref->second.isOffset)
{
- solAssert(variable->type()->sizeOnStack() == 2, "");
- if (ref->second.isOffset)
- stackDiff--;
+ solAssert(variable->type()->dataStoredIn(DataLocation::Storage), "");
+ unsigned size = variable->type()->sizeOnStack();
+ if (size == 2)
+ {
+ // slot plus offset
+ if (ref->second.isOffset)
+ stackDiff--;
+ }
+ else
+ {
+ solAssert(size == 1, "");
+ // only slot, offset is zero
+ if (ref->second.isOffset)
+ {
+ _assembly.append(u256(0));
+ return;
+ }
+ }
}
else
solAssert(variable->type()->sizeOnStack() == 1, "");