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

28 lines
637 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 {
2021-08-23 09:30:12 +00:00
// Disabled because of Spacer nondeterminism.
//h()[2] = 4;
2020-08-31 15:16:36 +00:00
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-08-23 09:30:12 +00:00
// Warning 6328: (335-354): CHC: Assertion violation might happen here.
2021-10-06 09:53:03 +00:00
// Info 1180: Contract invariant(s) for :C:\n!(a.length <= 2)\n!(a.length <= 3)\n
2021-08-23 09:30:12 +00:00
// Warning 4661: (335-354): BMC: Assertion violation happens here.