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

29 lines
705 B
Solidity
Raw Normal View History

2020-08-31 15:16:36 +00:00
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);
}
}
// ====
2021-03-31 15:11:54 +00:00
// SMTEngine: all
// SMTIgnoreCex: yes
2020-08-31 15:16:36 +00:00
// ----
2021-03-31 15:11:54 +00:00
// Warning 6368: (207-211): CHC: Out of bounds access happens here.
// Warning 6368: (221-225): CHC: Out of bounds access happens here.
// Warning 6368: (271-277): CHC: Out of bounds access happens here.
// Warning 6368: (292-298): CHC: Out of bounds access happens here.
// Warning 6328: (285-304): CHC: Assertion violation happens here.