mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix false positive on external calls from constructors
This commit is contained in:
+1
-1
@@ -16,4 +16,4 @@ contract C {
|
||||
// SMTEngine: all
|
||||
// ----
|
||||
// Warning 6328: (69-85): CHC: Assertion violation happens here.\nCounterexample:\n\n_x = 100\n = 0\n\nTransaction trace:\nState.constructor()\nState.f(100)
|
||||
// Warning 6328: (177-191): CHC: Assertion violation happens here.\nCounterexample:\ns = 0, z = 3\n\nTransaction trace:\nC.constructor()\nState: s = 0, z = 3\nC.f()
|
||||
// Warning 6328: (177-191): CHC: Assertion violation happens here.\nCounterexample:\ns = 0, z = 0\n\nTransaction trace:\nC.constructor()\nState: s = 0, z = 0\nC.f()
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@ contract C {
|
||||
// SMTEngine: all
|
||||
// ----
|
||||
// Warning 6328: (69-85): CHC: Assertion violation happens here.\nCounterexample:\n\n_x = 100\n = 0\n\nTransaction trace:\nState.constructor()\nState.f(100)
|
||||
// Warning 6328: (203-217): CHC: Assertion violation happens here.\nCounterexample:\ns = 0, z = 0\n\nTransaction trace:\nC.constructor()\nState: s = 0, z = 0\nC.f()
|
||||
// Warning 6328: (203-217): CHC: Assertion violation happens here.\nCounterexample:\ns = 0, z = 3\n\nTransaction trace:\nC.constructor()\nState: s = 0, z = 3\nC.f()
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
interface D {
|
||||
function ext(C c) external returns (uint);
|
||||
}
|
||||
|
||||
contract C {
|
||||
uint x;
|
||||
function s(uint _x) public { x = _x; }
|
||||
constructor(D d) {
|
||||
uint a = d.ext(this);
|
||||
assert(x == 0); // should hold because there's no reentrancy from the constructor
|
||||
assert(a == 2); // should fail
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (253-267): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\nd = 0\na = 3\n\nTransaction trace:\nC.constructor(0)
|
||||
Reference in New Issue
Block a user