solidity/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol

25 lines
571 B
Solidity

pragma experimental SMTChecker;
contract LoopFor2 {
function testUnboundedForLoop(uint n, uint[] memory b, uint[] memory c) public pure {
b[0] = 900;
uint[] memory a = b;
require(n > 0 && n < 100);
uint i;
while (i < n) {
b[i] = i + 1;
c[i] = b[i];
++i;
}
assert(b[0] == c[0]);
assert(a[0] == 900);
assert(b[0] == 900);
}
}
// ====
// SMTSolvers: z3
// ----
// Warning 4661: (281-301): Assertion violation happens here
// Warning 4661: (305-324): Assertion violation happens here
// Warning 4661: (328-347): Assertion violation happens here