Merge pull request #9515 from ethereum/smt_fix_extra_parens

[SMTChecker] Fix ICE when tuples have extra effectless parens
This commit is contained in:
chriseth 2020-07-27 14:09:28 +02:00 committed by GitHub
commit da189a6678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 1 deletions

View File

@ -35,6 +35,7 @@ Bugfixes:
* Inheritance: Disallow public state variables overwriting ``pure`` functions. * Inheritance: Disallow public state variables overwriting ``pure`` functions.
* NatSpec: Constructors and functions have consistent userdoc output. * NatSpec: Constructors and functions have consistent userdoc output.
* SMTChecker: Fix internal error when assigning to a 1-tuple. * SMTChecker: Fix internal error when assigning to a 1-tuple.
* SMTChecker: Fix internal error when tuples have extra effectless parenthesis.
* State Mutability: Constant public state variables are considered ``pure`` functions. * State Mutability: Constant public state variables are considered ``pure`` functions.
* Type Checker: Fixing deduction issues on function types when function call has named arguments. * Type Checker: Fixing deduction issues on function types when function call has named arguments.
* Immutables: Fix internal compiler error when immutables are not assigned. * Immutables: Fix internal compiler error when immutables are not assigned.

View File

@ -1470,7 +1470,7 @@ void SMTEncoder::assignment(
void SMTEncoder::tupleAssignment(Expression const& _left, Expression const& _right) void SMTEncoder::tupleAssignment(Expression const& _left, Expression const& _right)
{ {
auto lTuple = dynamic_cast<TupleExpression const*>(&_left); auto lTuple = dynamic_cast<TupleExpression const*>(innermostTuple(dynamic_cast<TupleExpression const&>(_left)));
solAssert(lTuple, ""); solAssert(lTuple, "");
auto const& lComponents = lTuple->components(); auto const& lComponents = lTuple->components();

View File

@ -0,0 +1,7 @@
pragma experimental SMTChecker;
contract C {
function f2() public pure returns(int) {
int a;
((, a)) = (1, 2);
}
}

View File

@ -0,0 +1,7 @@
pragma experimental SMTChecker;
contract C {
function f2() public pure returns(int) {
int a;
(((, a),)) = ((1, 2), 3);
}
}

View File

@ -0,0 +1,7 @@
pragma experimental SMTChecker;
contract C {
function f2() public pure returns(int) {
int a;
(((((((, a),)))))) = ((1, 2), 3);
}
}

View File

@ -0,0 +1,7 @@
pragma experimental SMTChecker;
contract C {
function f2() public pure returns(int) {
int a;
((((((, a)))),)) = ((1, 2), 3);
}
}

View File

@ -0,0 +1,7 @@
pragma experimental SMTChecker;
contract C {
function f2() public pure returns(int) {
int a;
((((((((((((, a))))))),))))) = ((1, 2), 3);
}
}

View File

@ -0,0 +1,6 @@
pragma experimental SMTChecker;
contract C {
function f() public pure {
(((,))) = ((2),3);
}
}