mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add tests for the library bug
This commit is contained in:
parent
4e34359063
commit
6ae82fcec2
@ -0,0 +1,26 @@
|
|||||||
|
interface I {
|
||||||
|
function i() external;
|
||||||
|
}
|
||||||
|
|
||||||
|
library L {
|
||||||
|
function f(I _i) internal {
|
||||||
|
_i.i();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
uint x;
|
||||||
|
bool inG;
|
||||||
|
function s() public {
|
||||||
|
require(inG);
|
||||||
|
x = 2;
|
||||||
|
}
|
||||||
|
function g(I _i) public {
|
||||||
|
inG = true;
|
||||||
|
L.f(_i);
|
||||||
|
assert(x == 0);
|
||||||
|
inG = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6328: (296-310): CHC: Assertion violation happens here.\nCounterexample:\nx = 2, inG = true\n_i = 0\n\nTransaction trace:\nC.constructor()\nState: x = 0, inG = false\nC.g(0)\n L.f(0) -- internal call\n _i.i() -- untrusted external call, synthesized as:\n C.s() -- reentrant call
|
@ -0,0 +1,29 @@
|
|||||||
|
interface I {
|
||||||
|
function i() external;
|
||||||
|
}
|
||||||
|
|
||||||
|
library L {
|
||||||
|
function f(I _i) internal {
|
||||||
|
_i.i();
|
||||||
|
}
|
||||||
|
function g(I _i) internal {
|
||||||
|
f(_i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
uint x;
|
||||||
|
bool inG;
|
||||||
|
function s() public {
|
||||||
|
require(inG);
|
||||||
|
x = 2;
|
||||||
|
}
|
||||||
|
function g(I _i) public {
|
||||||
|
inG = true;
|
||||||
|
L.g(_i);
|
||||||
|
assert(x == 0);
|
||||||
|
inG = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6328: (337-351): CHC: Assertion violation happens here.\nCounterexample:\nx = 2, inG = true\n_i = 0\n\nTransaction trace:\nC.constructor()\nState: x = 0, inG = false\nC.g(0)\n L.g(0) -- internal call\n L.f(0) -- internal call\n _i.i() -- untrusted external call, synthesized as:\n C.s() -- reentrant call
|
@ -0,0 +1,32 @@
|
|||||||
|
interface I {
|
||||||
|
function i() external;
|
||||||
|
}
|
||||||
|
|
||||||
|
library M {
|
||||||
|
function f(I _i) internal {
|
||||||
|
_i.i();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
library L {
|
||||||
|
function g(I _i) internal {
|
||||||
|
M.f(_i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
uint x;
|
||||||
|
bool inG;
|
||||||
|
function s() public {
|
||||||
|
require(inG);
|
||||||
|
x = 2;
|
||||||
|
}
|
||||||
|
function g(I _i) public {
|
||||||
|
inG = true;
|
||||||
|
L.g(_i);
|
||||||
|
assert(x == 0);
|
||||||
|
inG = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6328: (354-368): CHC: Assertion violation happens here.\nCounterexample:\nx = 2, inG = true\n_i = 0\n\nTransaction trace:\nC.constructor()\nState: x = 0, inG = false\nC.g(0)\n L.g(0) -- internal call\n M.f(0) -- internal call\n _i.i() -- untrusted external call, synthesized as:\n C.s() -- reentrant call
|
Loading…
Reference in New Issue
Block a user