2020-03-20 23:32:30 +00:00
|
|
|
// Invoke some features that use memory and test that they do not interfere with each other.
|
|
|
|
contract Helper {
|
|
|
|
uint256 public flag;
|
|
|
|
|
2020-06-23 12:14:24 +00:00
|
|
|
constructor(uint256 x) {
|
2020-03-20 23:32:30 +00:00
|
|
|
flag = x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contract Main {
|
|
|
|
mapping(uint256 => uint256) map;
|
|
|
|
|
|
|
|
function f(uint256 x) public returns (uint256) {
|
|
|
|
map[x] = x;
|
|
|
|
return
|
|
|
|
(new Helper(uint256(keccak256(abi.encodePacked(this.g(map[x]))))))
|
|
|
|
.flag();
|
|
|
|
}
|
|
|
|
|
|
|
|
function g(uint256 a) public returns (uint256) {
|
|
|
|
return map[a];
|
|
|
|
}
|
|
|
|
}
|
2020-04-29 09:29:49 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-20 23:32:30 +00:00
|
|
|
// ----
|
|
|
|
// f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1
|
2021-04-29 09:40:54 +00:00
|
|
|
// gas irOptimized: 115543
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 127152
|
|
|
|
// gas legacyOptimized: 113679
|