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

24 lines
590 B
Solidity
Raw Normal View History

2019-02-21 12:01:58 +00:00
pragma experimental SMTChecker;
2020-02-12 02:21:42 +00:00
pragma experimental ABIEncoderV2;
2019-02-21 12:01:58 +00:00
contract C
{
uint[] array;
2020-02-12 02:21:42 +00:00
function f(uint[] memory a, uint[] memory b) public {
array[0] = 42;
2019-02-21 12:01:58 +00:00
uint[] storage c = array;
2020-02-12 02:21:42 +00:00
a[0] = 2;
2019-02-21 12:01:58 +00:00
b[0] = 1;
// Erasing knowledge about memory references should not
// erase knowledge about state variables.
assert(array[0] == 42);
// Erasing knowledge about memory references should not
// erase knowledge about storage references.
assert(c[0] == 42);
assert(a[0] == 2);
assert(b[0] == 1);
}
}
// ----
// Warning 4661: (476-493): Assertion violation happens here