mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[Sol->Yul] Fixing uncheked increment/decrement.
This commit is contained in:
parent
2a62814686
commit
dc3e76bc2c
@ -684,10 +684,11 @@ void IRGeneratorForStatements::endVisit(UnaryOperation const& _unaryOperation)
|
|||||||
IRVariable modifiedValue(m_context.newYulVariable(), resultType);
|
IRVariable modifiedValue(m_context.newYulVariable(), resultType);
|
||||||
IRVariable originalValue = readFromLValue(*m_currentLValue);
|
IRVariable originalValue = readFromLValue(*m_currentLValue);
|
||||||
|
|
||||||
|
bool checked = m_context.arithmetic() == Arithmetic::Checked;
|
||||||
define(modifiedValue) <<
|
define(modifiedValue) <<
|
||||||
(op == Token::Inc ?
|
(op == Token::Inc ?
|
||||||
m_utils.incrementCheckedFunction(resultType) :
|
(checked ? m_utils.incrementCheckedFunction(resultType) : m_utils.incrementWrappingFunction(resultType)) :
|
||||||
m_utils.decrementCheckedFunction(resultType)
|
(checked ? m_utils.decrementCheckedFunction(resultType) : m_utils.decrementWrappingFunction(resultType))
|
||||||
) <<
|
) <<
|
||||||
"(" <<
|
"(" <<
|
||||||
originalValue.name() <<
|
originalValue.name() <<
|
||||||
|
@ -11,6 +11,7 @@ contract C {
|
|||||||
return (x, c, b, a);
|
return (x, c, b, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// ----
|
// ----
|
||||||
// f() -> 0x1234, 0x0, 0x0, 0xfffe
|
// f() -> 0x1234, 0x0, 0x0, 0xfffe
|
||||||
|
Loading…
Reference in New Issue
Block a user