From e841b23bfd57607511d620ed34ef96188bbadec6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 25 Apr 2017 12:56:34 +0200 Subject: Special case for storage types with offset zero. --- libsolidity/codegen/ContractCompiler.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'libsolidity') 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, ""); -- cgit v1.2.3