mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9692 from ethereum/smt_fix_pop
[SMTChecker] Fix soundness of array pop
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user