solidity/test/libsolidity/smtCheckerTests/array_members/push_storage_ref_safe_aliasing.sol

17 lines
396 B
Solidity
Raw Normal View History

2020-05-18 14:33:27 +00:00
pragma experimental SMTChecker;
contract C {
uint[][] a;
function f() public {
a.push();
uint[] storage b = a[0];
b.push(8);
assert(b[b.length - 1] == 8);
// Safe but fails due to aliasing.
assert(a[0][a[0].length - 1] == 8);
}
}
// ----
2020-08-11 13:53:24 +00:00
// Warning 3944: (217-232): Underflow (resulting value less than 0) happens here
2020-07-13 18:48:00 +00:00
// Warning 6328: (205-239): Assertion violation happens here