[SMTChecker] Keep constraints of string literals after assignment

This commit is contained in:
Alex Beregszaszi 2020-09-25 10:34:18 +01:00
parent 5090353a1a
commit 9c1b041dcb
6 changed files with 4 additions and 11 deletions

View File

@ -5,7 +5,7 @@ Language Features:
Compiler Features:
* Export compiler-generated utility sources via standard-json or combined-json.
* SMTChecker: Keep knowledge about string literals and thus support the ``.length`` property properly.
* SMTChecker: Keep knowledge about string literals, even through assignment, and thus support the ``.length`` property properly.
* SMTChecker: Support events and low-level logs.
* SMTChecker: Support ``revert()``.
* SMTChecker: Support shifts.

View File

@ -1690,9 +1690,7 @@ void SMTEncoder::assignment(VariableDeclaration const& _variable, Expression con
// This is a special case where the SMT sorts are different.
// For now we are unaware of other cases where this happens, but if they do appear
// we should extract this into an `implicitConversion` function.
if (_variable.type()->category() != Type::Category::Array || _value.annotation().type->category() != Type::Category::StringLiteral)
assignment(_variable, expr(_value, _variable.type()));
// TODO else { store each string literal byte into the array }
assignment(_variable, expr(_value, _variable.type()));
}
void SMTEncoder::assignment(VariableDeclaration const& _variable, smtutil::Expression const& _value)

View File

@ -10,4 +10,4 @@ contract C {
}
}
// ----
// Warning 6328: (161-181): Assertion violation happens here.
// Warning 6328: (215-235): Assertion violation happens here.

View File

@ -11,5 +11,4 @@ contract C {
}
}
// ----
// Warning 6328: (164-184): Assertion violation happens here.
// Warning 6328: (194-214): Assertion violation happens here.
// Warning 6328: (248-268): Assertion violation happens here.

View File

@ -11,4 +11,3 @@ contract C {
}
}
// ----
// Warning 6328: (106-127): Assertion violation happens here.

View File

@ -16,6 +16,3 @@ contract C {
}
}
// ----
// Warning 6328: (111-140): Assertion violation happens here.
// Warning 6328: (217-246): Assertion violation happens here.
// Warning 6328: (353-382): Assertion violation happens here.