solidity/test/libsolidity/memoryGuardTests/dialectString/free_function.sol

29 lines
519 B
Solidity
Raw Normal View History

2022-02-10 16:57:43 +00:00
function safe() pure returns (uint256 x) {
assembly { x := 42 }
2022-02-14 12:21:00 +00:00
assembly "evmasm" ("memory-safe") { mstore(0, 0) }
2022-02-10 16:57:43 +00:00
}
function unsafe() pure returns (uint256 x) {
assembly { pop(mload(0)) }
}
contract C {
constructor() {
unsafe();
}
function f() public pure {
safe();
}
}
contract D {
constructor() {
safe();
}
function f() public pure {
unsafe();
}
}
// ----
// :C(creation) false
// :C(runtime) true
// :D(creation) true
// :D(runtime) false