Open lum7na opened 1 month ago
Legacy code generation does not have any guarantees about the evaluation order of complex expressions - and in this case, it evaluates the right summand before the left summand, s.t. the overflow error happens before the call to f()
.
via-IR code generation evaluates left-to-right, which means f
will be called before the overflow error occurs and since it assembly-returns, the overflow check becomes unreachable.
These subtle differences are specified in https://docs.soliditylang.org/en/latest/ir-breaking-changes.html
Description
Hi! The following code does not result in an arithmetic overflow (the multiplication in the code) when
via-ir
compilation is enabled, and the return value ofg()
is wrong. I believe this overflow should occur. Specifically, if I remove thef()
function, the correct code causing overflow is generated. Could this be due to thereturn
in the inline assembly? Thereturn
opcode appears to have been misplaced.It appears that the
g()
function has been discarded as a dead block.Environment