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

26 lines
640 B
Solidity
Raw Normal View History

2019-02-21 12:01:58 +00:00
pragma experimental SMTChecker;
contract C
{
uint[] array;
2020-02-12 02:21:42 +00:00
uint[][] array2d;
2019-02-21 12:01:58 +00:00
function f(uint[] storage a, uint[] storage b) internal {
2020-02-12 02:21:42 +00:00
a[0] = 2;
b[0] = 42;
2019-02-21 12:01:58 +00:00
array[0] = 1;
// Fails because array == a is possible.
assert(a[0] == 2);
// Fails because array == b is possible.
assert(b[0] == 42);
assert(array[0] == 1);
}
2020-02-12 02:21:42 +00:00
function g(uint x, uint y) public {
f(array2d[x], array2d[y]);
}
2019-02-21 12:01:58 +00:00
}
// ----
2020-02-12 02:21:42 +00:00
// Warning: (225-242): Assertion violation happens here
// Warning: (289-307): Assertion violation happens here
// Warning: (225-242): Assertion violation happens here
// Warning: (289-307): Assertion violation happens here