mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix allocation of byte arrays.
This commit is contained in:
@@ -8060,7 +8060,7 @@ BOOST_AUTO_TEST_CASE(create_memory_array_allocation_size)
|
||||
// multiple of 32
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
function f() public pure returns (uint d1, uint d2, uint d3) {
|
||||
function f() public pure returns (uint d1, uint d2, uint d3, uint memsize) {
|
||||
bytes memory b1 = new bytes(31);
|
||||
bytes memory b2 = new bytes(32);
|
||||
bytes memory b3 = new bytes(256);
|
||||
@@ -8069,12 +8069,13 @@ BOOST_AUTO_TEST_CASE(create_memory_array_allocation_size)
|
||||
d1 := sub(b2, b1)
|
||||
d2 := sub(b3, b2)
|
||||
d3 := sub(b4, b3)
|
||||
memsize := msize()
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(0x40, 0x40, 0x20 + 256));
|
||||
ABI_CHECK(callContractFunction("f()"), encodeArgs(0x40, 0x40, 0x20 + 256, 0x260));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(memory_arrays_of_various_sizes)
|
||||
|
||||
Reference in New Issue
Block a user