-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Packages versions
next branch
Bug description
For example (-1i8).overflowing_div(-2i8):
Rust result: (0, false)
Rust result as bytes: [0, 0] // expected
Vm out bytes: [1, 0] // actual
Rust source
pub fn f(a: i8, b: i8) -> (i8, bool) {
a.overflowing_div(b)
}Potential explanation
Based on the generated test_overflowing_div_i8.hir:
- The generated hir entrypoint has
i32arguments for what are originallyi8operands - Perhaps the operands have been zero-extended instead of sign-extended
-1i8 = 0xFF: zext yields 255i32, sext yields -1i32-2i8 = 0xFE: zext yields 254i32, sext yields -2i32255/254 = 1instead of-1/-2 = 0
How can this be reproduced?
- Checkout test: add tests for
overflowingarith #959 - Unignore
test_overflowing_div_i8inrust_masm_tests/instructions.rs - Execute it with:
UPDATE_EXPECT=1 cargo nextest run -p miden-integration-tests -- rust_masm_tests::instructions::test_overflowing_div_i8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels