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

30 lines
644 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
{
function f(
uint[] memory a,
uint[] memory b,
uint[][] memory cc,
uint8[][] memory dd,
uint[][][] memory eee
2020-02-12 02:21:42 +00:00
) public pure {
a[0] = 2;
cc[0][0] = 50;
dd[0][0] = 10;
eee[0][0][0] = 50;
2019-02-21 12:01:58 +00:00
b[0] = 1;
2020-02-12 02:21:42 +00:00
// Fails because
// b == a is possible
// b == cc[0] is possible
// b == ee[0][0] is possible
assert(a[0] == 2 || cc[0][0] == 50 || eee[0][0][0] == 50);
2019-02-21 12:01:58 +00:00
// Should not fail since knowledge is erased only for uint[].
assert(dd[0][0] == 10);
assert(b[0] == 1);
}
}
// ----
2020-07-13 18:48:00 +00:00
// Warning 6328: (400-457): Assertion violation happens here