mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-10-20 18:56:17 +00:00
Existing test coverage didn't catch a signed remainder overflow semantics edge case behavior where at least one the operators is being constant folded by LLVM instead of solc. This PR fixes the SREM translation bug and adds missing test coverage for division ops with constants. Closes #524 --------- Signed-off-by: xermicus <cyrill@parity.io>
19 lines
585 B
Plaintext
19 lines
585 B
Plaintext
/// Probe: `mulmod(a, b, 0)` — sibling of `AddModZeroProbe`. EVM = 0.
|
|
object "MulModZeroProbe" {
|
|
code {
|
|
let size := datasize("MulModZeroProbe_deployed")
|
|
codecopy(0, dataoffset("MulModZeroProbe_deployed"), size)
|
|
return(0, size)
|
|
}
|
|
object "MulModZeroProbe_deployed" {
|
|
code {
|
|
let tag := calldataload(0)
|
|
let a := calldataload(32)
|
|
let b := calldataload(64)
|
|
let modulus := sub(shl(8, 1), shl(8, 1))
|
|
mstore(0, xor(mulmod(a, b, modulus), tag))
|
|
return(0, 32)
|
|
}
|
|
}
|
|
}
|