solidity/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol
2020-04-24 11:55:58 +02:00

24 lines
509 B
Solidity

pragma experimental SMTChecker;
contract LoopFor2 {
uint[] b;
uint[] c;
function testUnboundedForLoop(uint n) public {
b[0] = 900;
uint[] memory a = b;
require(n > 0 && n < 100);
for (uint i = 0; i < n; i += 1) {
b[i] = i + 1;
c[i] = b[i];
}
// This is safe but too hard to solve currently.
assert(b[0] == c[0]);
assert(a[0] == 900);
assert(b[0] == 900);
}
}
// ----
// Warning: (316-336): Assertion violation happens here
// Warning: (363-382): Assertion violation happens here