Merge pull request #5593 from ethereum/issue-5384

Fix expression simplifier asserting on default values
This commit is contained in:
chriseth 2018-12-05 17:58:23 +01:00 committed by GitHub
commit 32c9da9419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -114,7 +114,8 @@ bool Pattern::matches(Expression const& _expr, map<YulString, Expression const*>
{
YulString varName = boost::get<Identifier>(_expr).name;
if (_ssaValues.count(varName))
expr = _ssaValues.at(varName);
if (Expression const* new_expr = _ssaValues.at(varName))
expr = new_expr;
}
assertThrow(expr, OptimizerException, "");

View File

@ -0,0 +1,14 @@
// c & d can't be optimized as expression simplifier doesn't handle default
// values yet
{
let c
let d
let y := add(d, add(c, 7))
}
// ----
// expressionSimplifier
// {
// let c
// let d
// let y := add(add(d, c), 7)
// }