Merge pull request #6371 from ethereum/smt_variable_usage_function_calls

[SMTChecker] Merge SSA state vars properly
This commit is contained in:
chriseth
2019-03-28 15:54:31 +01:00
committed by GitHub
7 changed files with 122 additions and 31 deletions
@@ -0,0 +1,19 @@
pragma experimental SMTChecker;
contract C
{
uint x;
function f() internal {
require(x < 10000);
x = x + 1;
}
function g(bool b) public {
x = 0;
if (b)
f();
// Should fail for `b == true`.
assert(x == 0);
}
}
// ----
// Warning: (209-223): Assertion violation happens here
@@ -0,0 +1,18 @@
pragma experimental SMTChecker;
contract C
{
uint x;
function f() internal {
require(x < 10000);
x = x + 1;
}
function g(bool b) public {
x = 0;
if (b)
f();
else
f();
assert(x == 1);
}
}
@@ -0,0 +1,28 @@
pragma experimental SMTChecker;
contract C
{
uint x;
function f() internal {
require(x < 10000);
x = x + 1;
}
function g(bool b) public {
x = 0;
if (b)
f();
// Should fail for `b == true`.
assert(x == 0);
}
function h(bool b) public {
x = 0;
if (!b)
f();
// Should fail for `b == false`.
assert(x == 0);
}
}
// ----
// Warning: (209-223): Assertion violation happens here
// Warning: (321-335): Assertion violation happens here