2020-11-23 18:06:44 +00:00
|
|
|
pragma abicoder v2;
|
2019-05-08 13:39:17 +00:00
|
|
|
|
|
|
|
contract C {
|
|
|
|
function g(address x) external pure returns (uint256 r) {
|
|
|
|
assembly { r := x }
|
|
|
|
}
|
|
|
|
function f(uint256 a) external view returns (uint256) {
|
|
|
|
address x;
|
|
|
|
assembly { x := a }
|
|
|
|
return this.g(x);
|
|
|
|
}
|
|
|
|
}
|
2020-04-17 20:24:33 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2019-05-08 13:39:17 +00:00
|
|
|
// ----
|
|
|
|
// f(uint256): 0 -> 0
|
|
|
|
// g(address): 0 -> 0 # test validation as well as sanity check #
|
|
|
|
// f(uint256): 1 -> 1
|
|
|
|
// g(address): 1 -> 1
|
|
|
|
// f(uint256): 2 -> 2
|
|
|
|
// g(address): 2 -> 2
|
|
|
|
// f(uint256): 0xabcdef0123456789abcdef0123456789abcdefff -> 0xabcdef0123456789abcdef0123456789abcdefff
|
|
|
|
// g(address): 0xabcdef0123456789abcdef0123456789abcdefff -> 0xabcdef0123456789abcdef0123456789abcdefff
|
|
|
|
// f(uint256): 0xffffffffffffffffffffffffffffffffffffffff -> 0xffffffffffffffffffffffffffffffffffffffff
|
|
|
|
// g(address): 0xffffffffffffffffffffffffffffffffffffffff -> 0xffffffffffffffffffffffffffffffffffffffff
|
|
|
|
// f(uint256): 0x010000000000000000000000000000000000000000 -> 0
|
|
|
|
// g(address): 0x010000000000000000000000000000000000000000 -> FAILURE
|
|
|
|
// f(uint256): 0x01abcdef0123456789abcdef0123456789abcdefff -> 0xabcdef0123456789abcdef0123456789abcdefff
|
|
|
|
// g(address): 0x01abcdef0123456789abcdef0123456789abcdefff -> FAILURE
|
|
|
|
// f(uint256): 0x01ffffffffffffffffffffffffffffffffffffffff -> 0xffffffffffffffffffffffffffffffffffffffff
|
|
|
|
// g(address): 0x01ffffffffffffffffffffffffffffffffffffffff -> FAILURE
|
|
|
|
// f(uint256): -1 -> 0xffffffffffffffffffffffffffffffffffffffff
|
|
|
|
// g(address): -1 -> FAILURE
|