mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9925 from ethereum/develop
Merge develop into breaking.
This commit is contained in:
+2
-4
@@ -14,13 +14,11 @@ contract LoopFor2 {
|
||||
c[i] = b[i];
|
||||
++i;
|
||||
}
|
||||
// Fails as false positive.
|
||||
assert(b[0] == c[0]);
|
||||
assert(a[0] == 900);
|
||||
assert(b[0] == 900);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (320-339): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (343-362): CHC: Assertion violation happens here.
|
||||
// Warning 4661: (296-316): BMC: Assertion violation happens here.
|
||||
// Warning 6328: (290-309): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (313-332): CHC: Assertion violation happens here.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assert(addmod(2**256 - 1, 10, 9) == 7);
|
||||
uint y = 0;
|
||||
uint x = addmod(2**256 - 1, 10, y);
|
||||
assert(x == 1);
|
||||
}
|
||||
function g(uint x, uint y, uint k) public pure returns (uint) {
|
||||
return addmod(x, y, k);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 1218: (83-108): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (141-166): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (76-114): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (170-184): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (263-278): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 3046: (141-166): BMC: Division by zero happens here.
|
||||
// Warning 3046: (263-278): BMC: Division by zero happens here.
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function test() public pure {
|
||||
uint x;
|
||||
if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7)) x = 1;
|
||||
if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7)) x = 2;
|
||||
assert(x == 0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 1218: (118-143): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (183-208): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (219-233): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 6838: (93-143): BMC: Condition is always false.
|
||||
// Warning 6838: (158-208): BMC: Condition is always false.
|
||||
@@ -0,0 +1,35 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f(uint256 d) public pure {
|
||||
uint x = addmod(1, 2, d);
|
||||
assert(x < d);
|
||||
}
|
||||
|
||||
function g(uint256 d) public pure {
|
||||
uint x = mulmod(1, 2, d);
|
||||
assert(x < d);
|
||||
}
|
||||
|
||||
function h() public pure returns (uint256) {
|
||||
uint x = mulmod(0, 1, 2);
|
||||
uint y = mulmod(1, 0, 2);
|
||||
assert(x == y);
|
||||
uint z = addmod(0, 1, 2);
|
||||
uint t = addmod(1, 0, 2);
|
||||
assert(z == t);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 1218: (94-109): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (113-126): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (180-195): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (199-212): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (275-290): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (303-318): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (349-364): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (377-392): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (322-336): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (396-410): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 3046: (94-109): BMC: Division by zero happens here.
|
||||
// Warning 3046: (180-195): BMC: Division by zero happens here.
|
||||
@@ -0,0 +1,24 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function test_addmod(uint x, uint y) public pure {
|
||||
require(x % 13 == 0);
|
||||
require(y % 13 == 0);
|
||||
|
||||
uint z = addmod(x, y, 13);
|
||||
assert(z == 0);
|
||||
}
|
||||
function test_mulmod(uint x, uint y) public pure {
|
||||
require(x % 13 == 0);
|
||||
require(y % 13 == 0);
|
||||
|
||||
uint z = mulmod(x, y, 13);
|
||||
assert(z == 0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 1218: (158-174): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (178-192): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (309-325): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (329-343): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 7812: (329-343): BMC: Assertion violation might happen here.
|
||||
@@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assert(mulmod(2**256 - 1, 2, 14) == 2);
|
||||
uint y = 0;
|
||||
uint x = mulmod(2**256 - 1, 10, y);
|
||||
assert(x == 1);
|
||||
}
|
||||
function g(uint x, uint y, uint k) public pure returns (uint) {
|
||||
return mulmod(x, y, k);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 1218: (83-108): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (141-166): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (76-114): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (170-184): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 1218: (263-278): CHC: Error trying to invoke SMT solver.
|
||||
// Warning 3046: (141-166): BMC: Division by zero happens here.
|
||||
// Warning 3046: (263-278): BMC: Division by zero happens here.
|
||||
Reference in New Issue
Block a user