solidity/test/libsolidity/smtCheckerTests/external_calls/external_hash_known_code_state.sol
2020-07-23 18:49:03 +02:00

39 lines
745 B
Solidity

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;
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);
}
}
// ----
// Warning 6328: (528-565): Assertion violation happens here
// Warning 5084: (544-554): Type conversion is not yet fully supported and might yield false positives.