solidity/test/libsolidity/smtCheckerTests/overflow/overflow_constant_bound.sol
2023-03-09 14:59:32 +01:00

19 lines
666 B
Solidity

contract DepositContract {
uint constant MAX_DEPOSIT_COUNT = 2**32 - 1;
uint256 deposit_count;
uint256 deposit_count_2;
function deposit() external {
require(deposit_count < MAX_DEPOSIT_COUNT);
deposit_count += 1;
deposit_count_2 += 10; // should fail
}
}
// ====
// SMTEngine: all
// ----
// Warning 4984: (256-277): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
// Warning 2661: (256-277): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.