solidity/test/libsolidity/smtCheckerTests/types/array_aliasing_storage_2.sol

24 lines
550 B
Solidity
Raw Normal View History

2019-02-21 12:01:58 +00:00
pragma experimental SMTChecker;
contract C
{
2020-02-12 02:21:42 +00:00
uint[][] array2d;
function g(uint x, uint y, uint[] memory c) public {
f(array2d[x], array2d[y], c);
}
2019-02-21 12:01:58 +00:00
function f(uint[] storage a, uint[] storage b, uint[] memory c) internal {
2020-02-12 02:21:42 +00:00
c[0] = 42;
a[0] = 2;
2019-02-21 12:01:58 +00:00
b[0] = 1;
// Erasing knowledge about storage references should not
// erase knowledge about memory references.
assert(c[0] == 42);
// Fails because b == a is possible.
assert(a[0] == 2);
assert(b[0] == 1);
}
}
// ----
2020-07-13 18:48:00 +00:00
// Warning 6328: (436-453): Assertion violation happens here