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

20 lines
362 B
Solidity
Raw Normal View History

2018-11-09 16:06:30 +00:00
pragma experimental SMTChecker;
contract C
{
mapping (uint => uint) a;
mapping (uint => uint) b;
2020-02-12 02:21:42 +00:00
function f(uint x) public {
a[1] = x;
b[1] = x;
a[1] = 2;
2018-11-09 16:06:30 +00:00
mapping (uint => uint) storage c = a;
assert(c[1] == 2);
2018-11-09 16:06:30 +00:00
// False negative! Needs aliasing.
assert(a[1] == b[1]);
}
}
// ----
// Warning 4661: (266-286): Assertion violation happens here