Skip to content

Commit 8927015

Browse files
author
Martin Blicha
committed
[SMTChecker] Adding unary increment and decrement as under/overflow verification targets for the CHC engine
1 parent ccd1f28 commit 8927015

40 files changed

+150
-59
lines changed

Changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Compiler Features:
1414
* SMTChecker: Support getters.
1515
* SMTChecker: Support named arguments in function calls.
1616
* SMTChecker: Support struct constructor.
17+
* SMTChecker: Create underflow and overflow verification targets for increment/decrement in the CHC engine.
1718
* Standard-Json: Move the recently introduced ``modelCheckerSettings`` key to ``settings.modelChecker``.
1819
* Standard-Json: Properly filter the requested output artifacts.
1920

libsolidity/formal/BMC.cpp

+1-16
Original file line numberDiff line numberDiff line change
@@ -356,27 +356,12 @@ void BMC::endVisit(UnaryOperation const& _op)
356356
)
357357
return;
358358

359-
switch (_op.getOperator())
360-
{
361-
case Token::Inc: // ++ (pre- or postfix)
362-
case Token::Dec: // -- (pre- or postfix)
359+
if (_op.getOperator() == Token::Sub && smt::isInteger(*_op.annotation().type))
363360
addVerificationTarget(
364361
VerificationTarget::Type::UnderOverflow,
365362
expr(_op),
366363
&_op
367364
);
368-
break;
369-
case Token::Sub: // -
370-
if (_op.annotation().type->category() == Type::Category::Integer)
371-
addVerificationTarget(
372-
VerificationTarget::Type::UnderOverflow,
373-
expr(_op),
374-
&_op
375-
);
376-
break;
377-
default:
378-
break;
379-
}
380365
}
381366

382367
void BMC::endVisit(FunctionCall const& _funCall)

libsolidity/formal/SMTEncoder.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,13 @@ void SMTEncoder::endVisit(UnaryOperation const& _op)
512512
auto decl = identifierToVariable(*identifier);
513513
solAssert(decl, "");
514514
auto innerValue = currentValue(*decl);
515-
auto newValue = _op.getOperator() == Token::Inc ? innerValue + 1 : innerValue - 1;
515+
auto newValue = arithmeticOperation(
516+
_op.getOperator() == Token::Inc ? Token::Add : Token::Sub,
517+
innerValue,
518+
smtutil::Expression(size_t(1)),
519+
_op.annotation().type,
520+
_op
521+
).first;
516522
defineExpr(_op, _op.isPrefixOperation() ? newValue : innerValue);
517523
assignment(*decl, newValue);
518524
}
@@ -522,7 +528,13 @@ void SMTEncoder::endVisit(UnaryOperation const& _op)
522528
)
523529
{
524530
auto innerValue = expr(*subExpr);
525-
auto newValue = _op.getOperator() == Token::Inc ? innerValue + 1 : innerValue - 1;
531+
auto newValue = arithmeticOperation(
532+
_op.getOperator() == Token::Inc ? Token::Add : Token::Sub,
533+
innerValue,
534+
smtutil::Expression(size_t(1)),
535+
_op.annotation().type,
536+
_op
537+
).first;
526538
defineExpr(_op, _op.isPrefixOperation() ? newValue : innerValue);
527539
indexOrMemberAssignment(*subExpr, newValue);
528540
}

test/libsolidity/smtCheckerTests/array_members/pop_loop_safe.sol

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ contract C {
99
}
1010
}
1111
}
12+
// ----
13+
// Warning 4984: (112-115): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.

test/libsolidity/smtCheckerTests/array_members/pop_loop_unsafe.sol

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ contract C {
1111
}
1212
}
1313
// ----
14+
// Warning 4984: (112-115): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
1415
// Warning 2529: (150-157): CHC: Empty array "pop" happens here.\nCounterexample:\na = []\nl = 0\n\n\nTransaction trace:\nconstructor()\nState: a = []\nf(0)

test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe_no_overflow_assumption.sol

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ contract C {
1111
assert(x[0] == 42);
1212
}
1313
}
14+
// ----
15+
// Warning 4984: (174-177): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
pragma experimental SMTChecker;
2+
contract C {
3+
uint8 x;
4+
5+
function inc_pre() public {
6+
++x;
7+
}
8+
9+
function dec_pre() public {
10+
--x;
11+
}
12+
13+
/* Commented out because Spacer segfaults in Z3 4.8.9
14+
function inc_post() public {
15+
x++;
16+
}
17+
18+
function dec_post() public {
19+
x--;
20+
}
21+
*/
22+
23+
}
24+
// ====
25+
// SMTEngine: bmc
26+
// ----
27+
// Warning 2661: (87-90): BMC: Overflow (resulting value larger than 255) happens here.
28+
// Warning 4144: (127-130): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/control_flow/return_1.sol

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ contract C {
1919
}
2020
}
2121
// ----
22-
// Warning 2661: (158-161): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/control_flow/return_1_fail.sol

-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ contract C {
2323
// Warning 6328: (274-300): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
2424
// Warning 6328: (304-330): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
2525
// Warning 6328: (334-362): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
26-
// Warning 2661: (158-161): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/control_flow/return_2.sol

-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ contract C {
2828
}
2929
}
3030
// ----
31-
// Warning 2661: (188-191): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/control_flow/return_2_fail.sol

-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ contract C {
3838
// Warning 6328: (437-458): CHC: Assertion violation happens here.
3939
// Warning 6328: (462-490): CHC: Assertion violation happens here.
4040
// Warning 6328: (494-517): CHC: Assertion violation happens here.
41-
// Warning 2661: (188-191): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/external_calls/external_inc.sol

+1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ contract C {
1818
}
1919
}
2020
// ----
21+
// Warning 4984: (146-149): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
2122
// Warning 6328: (189-203): CHC: Assertion violation happens here.\nCounterexample:\nx = 10, d = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, d = 0\ninc()\nState: x = 1, d = 0\nf()
2223
// Warning 2661: (146-149): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/external_calls/external_safe.sol

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ contract C {
1616
assert(x < 11);
1717
}
1818
}
19+
// ----
20+
// Warning 6328: (200-214): CHC: Assertion violation might happen here.
21+
// Warning 4661: (200-214): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1.sol

-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ contract C{
2121
}
2222
// ----
2323
// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
24-
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
25-
// Warning 4144: (238-241): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_1_fail.sol

-2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ contract C{
2626
// Warning 6328: (220-234): CHC: Assertion violation happens here.\nCounterexample:\nx = 2\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
2727
// Warning 6328: (245-259): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
2828
// Warning 6328: (82-96): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\ny = 0\n\n\nTransaction trace:\nconstructor(0)
29-
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
30-
// Warning 4144: (238-241): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1.sol

-2
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ contract C is A {
1717
}
1818
}
1919
// ----
20-
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.
21-
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/functions/internal_call_with_assertion_inheritance_1_fail.sol

-2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ contract C is A {
2020
// Warning 6328: (82-96): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor()
2121
// Warning 6328: (148-162): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n\n\n\nTransaction trace:\nconstructor()
2222
// Warning 6328: (180-194): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n\n\n\nTransaction trace:\nconstructor()
23-
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.
24-
// Warning 4144: (100-103): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1.sol

-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ contract C{
2121
}
2222
// ----
2323
// Warning 5667: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
24-
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
25-
// Warning 2661: (163-166): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
26-
// Warning 2661: (234-237): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
27-
// Warning 4144: (234-237): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/functions/internal_multiple_calls_with_assertion_1_fail.sol

-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,3 @@ contract C{
2424
// Warning 6328: (138-152): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
2525
// Warning 6328: (184-198): CHC: Assertion violation happens here.\nCounterexample:\nx = 1\n\n\n\nTransaction trace:\nconstructor(0)\nState: x = 1\nf()
2626
// Warning 6328: (82-96): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\ny = 0\n\n\nTransaction trace:\nconstructor(0)
27-
// Warning 2661: (156-159): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
28-
// Warning 2661: (163-166): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
29-
// Warning 2661: (234-237): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
30-
// Warning 4144: (234-237): BMC: Underflow (resulting value less than 0) happens here.

test/libsolidity/smtCheckerTests/imports/import_base.sol

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ contract Der is Base {
2020
// ----
2121
// Warning 4984: (der:101-109): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
2222
// Warning 6328: (der:113-126): CHC: Assertion violation happens here.\nCounterexample:\nx = 3, a = 0\ny = 0\n\n\nTransaction trace:\nconstructor()\nState: x = 0, a = 0\ng(0)
23+
// Warning 4984: (base:100-103): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
2324
// Warning 2661: (base:100-103): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
2425
// Warning 2661: (der:101-109): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
2526
// Warning 2661: (base:100-103): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/invariants/loop_basic.sol

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ contract Simple {
1111
}
1212
// ====
1313
// SMTSolvers: z3
14+
// ----
15+
// Warning 4984: (132-135): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.

test/libsolidity/smtCheckerTests/invariants/loop_basic_for.sol

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ contract Simple {
99
}
1010
// ====
1111
// SMTSolvers: z3
12+
// ----
13+
// Warning 4984: (116-119): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.

test/libsolidity/smtCheckerTests/loops/while_2_break_fail.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ contract C
1515
// SMTSolvers: z3
1616
// ----
1717
// Warning 5740: (120-123): Unreachable code.
18-
// Warning 6328: (131-145): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 1\n\n\nTransaction trace:\nconstructor()\nf(1)
18+
// Warning 6328: (131-145): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 3\n\n\nTransaction trace:\nconstructor()\nf(3)

test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_memory.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ contract LoopFor2 {
1818
}
1919
}
2020
// ====
21-
// SMTSolvers: z3
2221
// SMTIgnoreCex: yes
22+
// SMTSolvers: z3
2323
// ----
2424
// Warning 4984: (244-249): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
25+
// Warning 4984: (270-273): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
2526
// Warning 6328: (373-392): CHC: Assertion violation happens here.
2627
// Warning 6328: (396-415): CHC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ contract LoopFor2 {
2626
// SMTSolvers: z3
2727
// ----
2828
// Warning 4984: (237-242): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
29+
// Warning 4984: (263-266): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.

test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol

+1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ contract LoopFor2 {
2121
}
2222
// ----
2323
// Warning 4984: (229-234): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
24+
// Warning 4984: (255-258): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here.
2425
// Warning 6328: (338-357): CHC: Assertion violation happens here.\nCounterexample:\nb = [], c = []\nn = 1\n\n\nTransaction trace:\nconstructor()\nState: b = [], c = []\ntestUnboundedForLoop(1)
2526
// Warning 6328: (361-380): CHC: Assertion violation happens here.\nCounterexample:\nb = [], c = []\nn = 1\n\n\nTransaction trace:\nconstructor()\nState: b = [], c = []\ntestUnboundedForLoop(1)

test/libsolidity/smtCheckerTests/operators/assignment_contract_member_variable.sol

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ contract A {
77
A.y = A.x++;
88
assert(A.y == A.x - 1);
99
// Fails
10-
assert(A.y == 0);
10+
// assert(A.y == 0); // Disabled because of nondeterminism in Spacer
1111
A.y = ++A.x;
1212
assert(A.y == A.x);
1313
delete A.x;
@@ -25,6 +25,7 @@ contract A {
2525
assert(A.y == A.x);
2626
}
2727
}
28+
// ====
29+
// SMTIgnoreCex: yes
2830
// ----
29-
// Warning 6328: (160-176): CHC: Assertion violation happens here.\nCounterexample:\nx = (- 1), y = (- 2)\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\na()\nState: x = (- 2), y = (- 2)\na()
30-
// Warning 6328: (373-389): CHC: Assertion violation happens here.\nCounterexample:\nx = 8, y = (- 2)\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0, y = 0\na()
31+
// Warning 6328: (424-440): CHC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/operators/conditional_assignment_3.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ contract C {
1010
}
1111
}
1212
// ----
13-
// Warning 6328: (161-174): CHC: Assertion violation happens here.\nCounterexample:\n\na = 6\nb = 5\n\n\nTransaction trace:\nconstructor()\nf(5, 5)
13+
// Warning 6328: (161-174): CHC: Assertion violation happens here.\nCounterexample:\n\na = 0\nb = 1\n\n\nTransaction trace:\nconstructor()\nf(0, 0)

test/libsolidity/smtCheckerTests/operators/conditional_assignment_statevar_1.sol

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ contract C {
1010
}
1111
}
1212
// ----
13+
// Warning 4984: (129-134): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\na = 115792089237316195423570985008687907853269984665640564039457584007913129639935, b = false\n\nc = 0\n\nTransaction trace:\nconstructor()\nState: a = 0, b = false\nf()\nState: a = 115792089237316195423570985008687907853269984665640564039457584007913129639935, b = false\nf()
14+
// Warning 3944: (137-140): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\na = 0, b = false\n\nc = 0\n\nTransaction trace:\nconstructor()\nState: a = 0, b = false\nf()
15+
// Warning 6328: (150-163): CHC: Assertion violation happens here.\nCounterexample:\na = 115792089237316195423570985008687907853269984665640564039457584007913129639935, b = false\n\nc = 0\n\nTransaction trace:\nconstructor()\nState: a = 0, b = false\nf()

test/libsolidity/smtCheckerTests/operators/unary_add_array.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ contract C
1515
}
1616
}
1717
// ----
18-
// Warning 6328: (240-253): CHC: Assertion violation happens here.\nCounterexample:\narray = []\nx = 38\n\n\nTransaction trace:\nconstructor()\nState: array = []\nf(38)
18+
// Warning 6328: (240-253): CHC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/operators/unary_add_mapping.sol

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ contract C
1414
assert(b < 3);
1515
}
1616
}
17+
// ====
18+
// SMTIgnoreCex: yes
1719
// ----
18-
// Warning 6328: (244-257): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 38\n\n\nTransaction trace:\nconstructor()\nf(38)
20+
// Warning 6328: (244-257): CHC: Assertion violation happens here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
pragma experimental SMTChecker;
2+
contract C {
3+
uint8 x;
4+
5+
function inc_pre() public {
6+
++x;
7+
}
8+
9+
function dec_pre() public {
10+
--x;
11+
}
12+
13+
/* Commented out because Spacer segfaults in Z3 4.8.9
14+
function inc_post() public {
15+
x++;
16+
}
17+
18+
function dec_post() public {
19+
x--;
20+
}
21+
*/
22+
}
23+
// ----
24+
// Warning 4984: (87-90): CHC: Overflow (resulting value larger than 255) happens here.\nCounterexample:\nx = 255\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0\ndec_pre()\nState: x = 255\ninc_pre()
25+
// Warning 3944: (127-130): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\nx = 0\n\n\n\nTransaction trace:\nconstructor()\nState: x = 0\ndec_pre()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pragma experimental SMTChecker;
2+
3+
contract C {
4+
uint8 x = 254;
5+
6+
function inc_pre() public {
7+
++x;
8+
}
9+
10+
function check() view public {
11+
uint y = x;
12+
assert(y < 256);
13+
}
14+
}
15+
// ----
16+
// Warning 4984: (94-97): CHC: Overflow (resulting value larger than 255) happens here.\nCounterexample:\nx = 255\n\n\n\nTransaction trace:\nconstructor()\nState: x = 254\ninc_pre()\nState: x = 255\ninc_pre()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pragma experimental SMTChecker;
2+
3+
contract C {
4+
struct S {
5+
uint8 x;
6+
}
7+
8+
S s;
9+
10+
constructor() {
11+
s.x = 254;
12+
}
13+
14+
function inc_pre() public {
15+
++s.x;
16+
}
17+
18+
function check() view public {
19+
uint y = s.x;
20+
assert(y < 256);
21+
}
22+
}
23+
// ----
24+
// Warning 4984: (145-150): CHC: Overflow (resulting value larger than 255) happens here.\nCounterexample:\ns = {x: 255}\n\n\n\nTransaction trace:\nconstructor()\nState: s = {x: 254}\ninc_pre()\nState: s = {x: 255}\ninc_pre()

test/libsolidity/smtCheckerTests/operators/unary_sub_array.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ contract C
1515
}
1616
}
1717
// ----
18-
// Warning 6328: (240-253): CHC: Assertion violation happens here.\nCounterexample:\narray = []\nx = 38\n\n\nTransaction trace:\nconstructor()\nState: array = []\nf(38)
18+
// Warning 6328: (240-253): CHC: Assertion violation happens here.\nCounterexample:\narray = []\nx = 0\n\n\nTransaction trace:\nconstructor()\nState: array = []\nf(0)

test/libsolidity/smtCheckerTests/operators/unary_sub_mapping.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ contract C
1515
}
1616
}
1717
// ----
18-
// Warning 6328: (244-257): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 38\n\n\nTransaction trace:\nconstructor()\nf(38)
18+
// Warning 6328: (244-257): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 0\n\n\nTransaction trace:\nconstructor()\nf(0)

test/libsolidity/smtCheckerTests/types/struct/struct_recursive_6.sol

+4-8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ contract C {
5252
// Warning 8364: (258-260): Assertion checker does not yet implement type struct C.S storage ref
5353
// Warning 7650: (271-275): Assertion checker does not yet support this expression.
5454
// Warning 8364: (271-273): Assertion checker does not yet implement type struct C.S storage ref
55+
// Warning 4984: (132-138): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
56+
// Warning 4984: (142-148): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
57+
// Warning 3944: (165-171): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
58+
// Warning 3944: (175-181): CHC: Underflow (resulting value less than 0) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
5559
// Warning 4984: (200-208): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
5660
// Warning 6328: (185-209): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
5761
// Warning 6328: (213-247): CHC: Assertion violation happens here.\nCounterexample:\n\n\n\n\nTransaction trace:\nconstructor()\nf()
@@ -87,11 +91,3 @@ contract C {
8791
// Warning 8364: (258-260): Assertion checker does not yet implement type struct C.S storage ref
8892
// Warning 7650: (271-275): Assertion checker does not yet support this expression.
8993
// Warning 8364: (271-273): Assertion checker does not yet implement type struct C.S storage ref
90-
// Warning 4144: (132-138): BMC: Underflow (resulting value less than 0) happens here.
91-
// Warning 2661: (132-138): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
92-
// Warning 4144: (142-148): BMC: Underflow (resulting value less than 0) happens here.
93-
// Warning 2661: (142-148): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
94-
// Warning 4144: (165-171): BMC: Underflow (resulting value less than 0) happens here.
95-
// Warning 2661: (165-171): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
96-
// Warning 4144: (175-181): BMC: Underflow (resulting value less than 0) happens here.
97-
// Warning 2661: (175-181): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.

test/libsolidity/smtCheckerTests/types/struct/struct_unary_add.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ contract C {
1515
}
1616
}
1717
// ----
18-
// Warning 6328: (225-245): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 2, a: []}\ns2 = {x: 3, a: [5, 5, 5, 5, 5, 5]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: 3, a: [5, 5, 5, 5, 5, 5]})
18+
// Warning 6328: (225-245): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 2, a: []}\ns2 = {x: 3, a: [6, 6, 6, 6, 6, 6, 6]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: 3, a: [6, 6, 6, 6, 6, 6, 6]})

test/libsolidity/smtCheckerTests/types/struct/struct_unary_sub.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ contract C {
1616
}
1717
}
1818
// ----
19-
// Warning 6328: (240-260): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 98, a: []}\ns2 = {x: (- 38), a: [5, 5, 5, 5, 5, 5]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: (- 38), a: [5, 5, 5, 5, 5, 5]})
19+
// Warning 6328: (240-260): CHC: Assertion violation happens here.\nCounterexample:\n\ns1 = {x: 98, a: []}\ns2 = {x: 99, a: [6, 6, 6, 6, 6, 6, 6]}\n\n\nTransaction trace:\nconstructor()\nf({x: 0, a: []}, {x: 99, a: [6, 6, 6, 6, 6, 6, 6]})

0 commit comments

Comments
 (0)