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

25 lines
507 B
Solidity

contract C {
uint[] a;
uint l;
function p() public {
require(a.length < type(uint).max - 1);
require(l < type(uint).max - 1);
a.push();
++l;
}
function q() public {
require(a.length > 0);
require(l > 0);
a.pop();
--l;
}
function r() public view returns (uint) {
require(l > 0);
return a[l - 1]; // safe access
}
}
// ====
// SMTEngine: all
// ----
// Info 1391: CHC: 7 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.