aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity')
-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, "");