solidity/test/libsolidity/smtCheckerTests/operators/index_access_side_effect.sol

30 lines
720 B
Solidity
Raw Normal View History

2020-08-31 15:16:36 +00:00
pragma experimental SMTChecker;
contract C {
uint[] a;
2021-03-23 18:15:14 +00:00
constructor() {
a.push();
a.push();
a.push();
a.push();
}
// Accesses are safe but oob is reported due to aliasing.
2020-08-31 15:16:36 +00:00
function h() internal returns (uint[] storage) {
if (a[2] == 0)
a[2] = 3;
return a;
}
function g() public {
h()[2] = 4;
assert(h()[2] == 3);
}
}
// ====
// SMTIgnoreCex: yes
2020-08-31 15:16:36 +00:00
// ----
2021-03-23 18:15:14 +00:00
// Warning 6368: (240-244): CHC: Out of bounds access happens here.
// Warning 6368: (254-258): CHC: Out of bounds access happens here.
// Warning 6368: (304-310): CHC: Out of bounds access happens here.
// Warning 6368: (325-331): CHC: Out of bounds access happens here.
// Warning 6328: (318-337): CHC: Assertion violation happens here.