solidity/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol

32 lines
848 B
Solidity
Raw Normal View History

contract c {
uint256 a;
uint256 b;
uint256 c;
uint16[] inner = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
uint16[][] data;
function test() public returns (uint x, uint y, uint z) {
for (uint i = 1; i <= 48; i++)
data.push(inner);
for (uint j = 1; j <= 10; j++)
data.pop();
x = data[data.length - 1][0];
for (uint k = 1; k <= 10; k++)
data.pop();
y = data[data.length - 1][1];
for (uint l = 1; l <= 10; l++)
data.pop();
z = data[data.length - 1][2];
for (uint m = 1; m <= 18; m++)
data.pop();
delete inner;
}
}
// ====
// compileViaYul: also
// ----
// test() -> 1, 2, 3
2021-04-12 10:53:09 +00:00
// gas irOptimized: 2455497
2021-02-12 12:45:15 +00:00
// gas legacy: 2416722
// gas legacyOptimized: 2405396
// storageEmpty -> 1