solidity/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol
Nikola Matic fdc6699159 Rematerialize zero literals with default cleanup sequence
Add unused pruner step to the end of the default cleanup sequence
2023-09-04 15:40:33 +02:00

30 lines
600 B
Solidity

library L {
struct S { uint x; uint y; }
function f(uint[] storage r, S storage s) public returns (uint, uint, uint, uint) {
r[2] = 8;
s.x = 7;
return (r[0], r[1], s.x, s.y);
}
}
contract C {
uint8 x = 3;
L.S s;
uint[] r;
function f() public returns (uint, uint, uint, uint, uint, uint) {
r = new uint[](6);
r[0] = 1;
r[1] = 2;
r[2] = 3;
s.x = 11;
s.y = 12;
(uint a, uint b, uint c, uint d) = L.f(r, s);
return (r[2], s.x, a, b, c, d);
}
}
// ----
// library: L
// f() -> 8, 7, 1, 2, 7, 12
// gas irOptimized: 166475
// gas legacy: 169283
// gas legacyOptimized: 167248