mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Reset reference variables on assignment to a variable of reference type
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract A {
|
||||
int[] a;
|
||||
function f() public {
|
||||
require(a.length == 1 && a[0] == 1);
|
||||
int[] storage u = a;
|
||||
assert(u[0] == 1); // should hold
|
||||
int[] memory b = new int[](2);
|
||||
a = b;
|
||||
assert(u[0] == 1); // should fail
|
||||
A.a = b;
|
||||
assert(u[0] == 1); // should fail
|
||||
}
|
||||
|
||||
function push_v(int x) public {
|
||||
a.push(x);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (220-237): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (267-284): CHC: Assertion violation happens here.
|
||||
@@ -7,3 +7,5 @@ contract C
|
||||
assert(b1[1] == b2[1]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (119-141): CHC: Assertion violation happens here.\nCounterexample:\n\n\nTransaction trace:\nC.constructor()\nC.f(b1, b2)
|
||||
|
||||
Reference in New Issue
Block a user