aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-30 23:05:02 +0800
committerchriseth <c@ethdev.com>2015-11-30 23:05:02 +0800
commita3801be40c264296a6530d62141d96546b884190 (patch)
treed41d0990f034d218d53fea10486cc493be008ca2 /libsolidity
parentc806b9bcdb26fe031da94b8cdb270cb3c75b8af9 (diff)
parent6796afc2f8b441803a2c03f28271a1421935e536 (diff)
downloaddexon-solidity-a3801be40c264296a6530d62141d96546b884190.tar.gz
dexon-solidity-a3801be40c264296a6530d62141d96546b884190.tar.zst
dexon-solidity-a3801be40c264296a6530d62141d96546b884190.zip
Merge pull request #257 from chriseth/fixConstructorFixedArray
Bugfix for constructor unpacking with fixed-size arrays.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/codegen/Compiler.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/libsolidity/codegen/Compiler.cpp b/libsolidity/codegen/Compiler.cpp
index f1d95980..18803b71 100644
--- a/libsolidity/codegen/Compiler.cpp
+++ b/libsolidity/codegen/Compiler.cpp
@@ -305,11 +305,19 @@ void Compiler::appendCalldataUnpacker(TypePointers const& _typeParameters, bool
// @todo If base type is an array or struct, it is still calldata-style encoded, so
// we would have to convert it like below.
solAssert(arrayType.location() == DataLocation::Memory, "");
- // compute data pointer
- m_context << eth::Instruction::DUP1 << eth::Instruction::MLOAD;
- m_context << eth::Instruction::DUP3 << eth::Instruction::ADD;
- m_context << eth::Instruction::SWAP2 << eth::Instruction::SWAP1;
- m_context << u256(0x20) << eth::Instruction::ADD;
+ if (arrayType.isDynamicallySized())
+ {
+ // compute data pointer
+ m_context << eth::Instruction::DUP1 << eth::Instruction::MLOAD;
+ m_context << eth::Instruction::DUP3 << eth::Instruction::ADD;
+ m_context << eth::Instruction::SWAP2 << eth::Instruction::SWAP1;
+ m_context << u256(0x20) << eth::Instruction::ADD;
+ }
+ else
+ {
+ m_context << eth::Instruction::DUP1;
+ m_context << u256(arrayType.calldataEncodedSize(true)) << eth::Instruction::ADD;
+ }
}
else
{