solidity/test/libsolidity/smtCheckerTests/control_flow/short_circuit_or_inside_branch.sol

28 lines
462 B
Solidity
Raw Normal View History

2019-03-26 11:03:16 +00:00
pragma experimental SMTChecker;
contract c {
uint x;
function f() internal returns (uint) {
x = x + 1;
return x;
}
function g(bool a) public returns (bool) {
bool b;
if (a) {
x = 0;
b = (f() > 0) || (f() > 0);
assert(x == 1);
assert(b);
} else {
x = 100;
b = (f() == 0) || (f() > 0);
assert(x == 102);
// Should fail.
assert(!b);
}
return b;
}
}
// ----
2020-07-13 18:48:00 +00:00
// Warning 6328: (360-370): Assertion violation happens here