[Sol->Yul] Fixing uncheked increment/decrement.

This commit is contained in:
Djordje Mijovic 2021-01-14 13:38:23 +01:00
parent 2a62814686
commit dc3e76bc2c
2 changed files with 5 additions and 3 deletions

View File

@ -684,10 +684,11 @@ void IRGeneratorForStatements::endVisit(UnaryOperation const& _unaryOperation)
IRVariable modifiedValue(m_context.newYulVariable(), resultType);
IRVariable originalValue = readFromLValue(*m_currentLValue);
bool checked = m_context.arithmetic() == Arithmetic::Checked;
define(modifiedValue) <<
(op == Token::Inc ?
m_utils.incrementCheckedFunction(resultType) :
m_utils.decrementCheckedFunction(resultType)
(checked ? m_utils.incrementCheckedFunction(resultType) : m_utils.incrementWrappingFunction(resultType)) :
(checked ? m_utils.decrementCheckedFunction(resultType) : m_utils.decrementWrappingFunction(resultType))
) <<
"(" <<
originalValue.name() <<

View File

@ -11,6 +11,7 @@ contract C {
return (x, c, b, a);
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x1234, 0x0, 0x0, 0xfffe