Merge pull request #13569 from ethereum/document-call-to-zero-init-function-type

Document legacy and IR behavior for call to zero initialized variable of function type
This commit is contained in:
Daniel 2022-11-01 15:42:12 +01:00 committed by GitHub
commit 7ac4c70c9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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