2019-07-30 10:18:03 +00:00
|
|
|
pragma experimental SMTChecker;
|
|
|
|
|
|
|
|
contract LoopFor2 {
|
|
|
|
uint[] a;
|
|
|
|
|
|
|
|
function testUnboundedForLoop(uint n, uint[] memory b, uint[] memory c) public {
|
|
|
|
b[0] = 900;
|
|
|
|
a = b;
|
|
|
|
require(n > 0 && n < 100);
|
|
|
|
uint i;
|
|
|
|
while (i < n) {
|
|
|
|
b[i] = i + 1;
|
|
|
|
c[i] = b[i];
|
|
|
|
++i;
|
|
|
|
}
|
2019-08-20 13:03:45 +00:00
|
|
|
// Fails due to aliasing, since both b and c are
|
|
|
|
// memory references of same type.
|
2019-07-30 10:18:03 +00:00
|
|
|
assert(b[0] == c[0]);
|
|
|
|
assert(a[0] == 900);
|
|
|
|
assert(b[0] == 900);
|
|
|
|
}
|
|
|
|
}
|
2019-12-04 15:39:34 +00:00
|
|
|
// ====
|
|
|
|
// SMTSolvers: z3
|
2019-07-30 10:18:03 +00:00
|
|
|
// ----
|
2019-08-20 13:03:45 +00:00
|
|
|
// Warning: (362-382): Assertion violation happens here
|
|
|
|
// Warning: (409-428): Assertion violation happens here
|