mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix wrong cleanup when copying from calldata to memory
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
committed by
Daniel Kirchner
co-authored by
Kamil Śliwak
parent
5b0f4a724a
commit
22c7cd22b9
@@ -59,10 +59,10 @@ contract C {
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
// test_bytes() ->
|
||||
// gas irOptimized: 367365
|
||||
// gas legacy: 416585
|
||||
// gas legacyOptimized: 322043
|
||||
// gas irOptimized: 362445
|
||||
// gas legacy: 414569
|
||||
// gas legacyOptimized: 319271
|
||||
// test_uint256() ->
|
||||
// gas irOptimized: 515982
|
||||
// gas legacy: 583100
|
||||
// gas legacyOptimized: 444161
|
||||
// gas irOptimized: 511910
|
||||
// gas legacy: 581876
|
||||
// gas legacyOptimized: 442757
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
pragma abicoder v1;
|
||||
|
||||
contract C {
|
||||
function f(bool a, bytes calldata b, bytes32[2] calldata c)
|
||||
public
|
||||
returns (bool, bytes calldata, bytes32[2] calldata)
|
||||
{
|
||||
return (a, b, c);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: false
|
||||
// ----
|
||||
// f(bool,bytes,bytes32[2]): true, 0x80, "a", "b", 4, "abcd" -> true, 0x80, "a", "b", 4, "abcd"
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
pragma abicoder v1;
|
||||
|
||||
contract C {
|
||||
function f(uint256[] memory a, bytes calldata b) public returns (bytes memory) {
|
||||
return abi.encode(a, b);
|
||||
}
|
||||
|
||||
function g(uint256[] memory a, bytes calldata b) external returns (bytes memory) {
|
||||
return f(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
// f(uint256[],bytes): 0x40, 0x80, 1, 0xFF, 6, "123456" -> 0x20, 0xc0, 0x40, 0x80, 1, 0xff, 6, "123456"
|
||||
// g(uint256[],bytes): 0x40, 0x80, 1, 0xffff, 8, "12345678" -> 0x20, 0xc0, 0x40, 0x80, 1, 0xffff, 8, "12345678"
|
||||
Reference in New Issue
Block a user