Merge pull request #9692 from ethereum/smt_fix_pop

[SMTChecker] Fix soundness of array pop
This commit is contained in:
chriseth
2020-08-31 20:07:58 +02:00
committed by GitHub
11 changed files with 104 additions and 5 deletions
@@ -0,0 +1,11 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function f() public {
a.pop();
a.push();
}
}
// ----
// Warning 2529: (82-89): Empty array "pop" detected here
@@ -0,0 +1,11 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function f() public {
a.pop();
a.length;
}
}
// ----
// Warning 2529: (82-89): Empty array "pop" detected here
@@ -0,0 +1,12 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function f() public {
a.pop();
a.pop();
}
}
// ----
// Warning 2529: (82-89): Empty array "pop" detected here
// Warning 2529: (93-100): Empty array "pop" detected here
@@ -0,0 +1,11 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function f() public {
a.length;
a.pop();
}
}
// ----
// Warning 2529: (94-101): Empty array "pop" detected here
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function g() internal {
a.push();
}
function f() public {
a.pop();
g();
}
}
// ----
// Warning 2529: (122-129): Empty array "pop" detected here
@@ -0,0 +1,14 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function g() internal view {
a.length;
}
function f() public {
a.pop();
g();
}
}
// ----
// Warning 2529: (127-134): Empty array "pop" detected here
@@ -0,0 +1,9 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function f() public {
a.push();
a.pop();
}
}
@@ -0,0 +1,16 @@
pragma experimental SMTChecker;
contract C {
uint[] a;
function f() public {
a.pop();
a.push();
a.push();
a.push();
a.pop();
a.pop();
a.pop();
}
}
// ----
// Warning 2529: (82-89): Empty array "pop" detected here
@@ -9,4 +9,4 @@ contract C {
}
}
// ----
// Warning 2529: (111-121): Empty array "pop" detected here.
// Warning 2529: (111-121): Empty array "pop" detected here