solidity/test/libsolidity/smtCheckerTests/types/array_static_aliasing_storage_5.sol
2020-07-23 18:49:03 +02:00

25 lines
539 B
Solidity

pragma experimental SMTChecker;
contract C
{
uint[2] b1;
uint[2] b2;
function f(uint[2] storage a, uint[2] memory c) internal {
c[0] = 42;
a[0] = 2;
b1[0] = 1;
// Erasing knowledge about storage variables should not
// erase knowledge about memory references.
assert(c[0] == 42);
// Fails because b1 == a is possible.
assert(a[0] == 2);
assert(b1[0] == 1);
}
function g(bool x, uint[2] memory c) public {
if (x) f(b1, c);
else f(b2, c);
}
}
// ----
// Warning 6328: (338-355): Assertion violation happens here