solidity/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol

39 lines
745 B
Solidity
Raw Normal View History

pragma experimental SMTChecker;
contract State {
uint x;
function f() public returns (uint) {
if (x == 0) x = 1;
else if (x == 1) x = 2;
else if (x == 2) x = 0;
return x;
}
}
contract C {
address owner;
uint y;
uint z;
State s;
2020-06-23 12:14:24 +00:00
constructor() {
owner = msg.sender;
}
function f() public {
address prevOwner = owner;
y = s.f();
z = s.f();
assert(prevOwner == owner);
}
function inv() public view {
// This is safe but external calls do not yet support the state
// of the called contract.
assert(owner == address(0) || y != z);
}
}
// ----
2020-07-23 10:58:15 +00:00
// Warning 6328: (528-565): Assertion violation happens here
2020-06-23 12:14:24 +00:00
// Warning 5084: (544-554): Type conversion is not yet fully supported and might yield false positives.