Document legacy and IR behavior for call to zero initialized variable of function type.

This commit is contained in:
Bhargava Shastry 2022-09-27 13:31:10 +02:00
parent 311b2054af
commit bd57de6d68
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,27 @@
contract Other {
function addTwo(uint256 x) public returns (uint256) {
return x + 2;
}
}
contract C {
function (function (uint) external returns (uint)) internal returns (uint) ev;
function (uint) external returns (uint) x;
function store(function(uint) external returns (uint) y) public {
x = y;
}
function eval(function(uint) external returns (uint) y) public returns (uint) {
return y(7);
}
function t() public returns (uint256) {
this.store((new Other()).addTwo);
// This call panics
return ev(x);
}
}
// ====
// compileViaYul: true
// ----
// t() -> FAILURE, hex"4e487b71", 0x51

View File

@ -0,0 +1,27 @@
contract Other {
function addTwo(uint256 x) public returns (uint256) {
return x + 2;
}
}
contract C {
function (function (uint) external returns (uint)) internal returns (uint) ev;
function (uint) external returns (uint) x;
function store(function(uint) external returns (uint) y) public {
x = y;
}
function eval(function(uint) external returns (uint) y) public returns (uint) {
return y(7);
}
function t() public returns (uint256) {
this.store((new Other()).addTwo);
// This call panics
return ev(x);
}
}
// ====
// compileViaYul: false
// ----
// t() -> FAILURE