2019-06-27 11:36:06 +00:00
|
|
|
contract C {
|
|
|
|
function test(uint256 len, uint idx) public returns (uint256)
|
|
|
|
{
|
|
|
|
uint[] memory array = new uint[](len);
|
|
|
|
uint result = receiver(array, idx);
|
|
|
|
|
|
|
|
for (uint256 i = 0; i < array.length; i++)
|
|
|
|
require(array[i] == i + 1);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
function receiver(uint[] memory array, uint idx) public returns (uint256)
|
|
|
|
{
|
|
|
|
for (uint256 i = 0; i < array.length; i++)
|
|
|
|
array[i] = i + 1;
|
|
|
|
|
|
|
|
return array[idx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ====
|
2020-11-24 23:25:42 +00:00
|
|
|
// compileViaYul: also
|
2019-06-27 11:36:06 +00:00
|
|
|
// ----
|
2020-10-13 11:28:39 +00:00
|
|
|
// test(uint256,uint256): 0, 0 -> FAILURE, hex"4e487b71", 0x32
|
|
|
|
// test(uint256,uint256): 1, 0 -> 1
|
|
|
|
// test(uint256,uint256): 10, 5 -> 6
|
|
|
|
// test(uint256,uint256): 10, 50 -> FAILURE, hex"4e487b71", 0x32
|