solidity/test/libsolidity/smtCheckerTests/out_of_bounds/array_2.sol

24 lines
376 B
Solidity
Raw Normal View History

2021-03-23 18:15:14 +00:00
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
}
}
2021-03-31 15:11:54 +00:00
// ====
// SMTEngine: all
2021-03-23 18:15:14 +00:00
// ----