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

25 lines
539 B
Solidity
Raw Normal View History

pragma experimental SMTChecker;
contract C
{
2020-02-12 02:21:42 +00:00
uint[2] b1;
uint[2] b2;
function f(uint[2] storage a, uint[2] memory c) internal {
2020-02-12 02:21:42 +00:00
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);
2020-02-12 02:21:42 +00:00
// Fails because b1 == a is possible.
assert(a[0] == 2);
2020-02-12 02:21:42 +00:00
assert(b1[0] == 1);
}
function g(bool x, uint[2] memory c) public {
if (x) f(b1, c);
else f(b2, c);
}
}
// ----
2020-07-13 18:48:00 +00:00
// Warning 6328: (338-355): Assertion violation happens here