0xMiden / 0xMiden/compiler

Native/Masm divergence for `u128::saturating_(add|sub)`

未关闭
#1,355 0 条评论 0 个 reaction 已指派 1 人 已被 @mooori 认领 在 GitHub 查看
codegen
主要语言
Rust
星标
115
派生
84
平均合并
1 天 8 小时
30 天内合并 PR
15

描述

### Packages versions

N/A

### Bug description

Adding test coverage for saturating arithmetic fails for `u128` due to a divergence between Rust and Miden VM outputs

### How can this be reproduced?

```
cargo make test -E 'package(midenc-integration-tests)' -- end_to_end::arithmetic::saturating_add_u128
```

### Relevant log output

```shell
thread 'end_to_end::arithmetic::saturating_sub_u128' (215234908) panicked at tests/integration/src/end_to_end/arithmetic.rs:649:13:
Found minimal(shrinked) failing case: (340282366920938463463374607431768211455, 340282366920938463463374607431768211455)
Failure: Reason("assertion failed: `(left == right)` \n left: `340282366920938463444927863358058659840`, \n right: `0`: the Miden VM and Rust disagree on the value produced by this operation at tests/integration/src/end_to_end/arithmetic.rs:638")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

贡献指南

打开贡献指南

调研方向

The failing test is in tests/integration/src/end_to_end/arithmetic.rs, line 638. Run the specific test with the given cargo command to see the divergence between Rust and Miden VM for u128 saturating operations. Examine the compiler's code generation for saturating arithmetic on u128, likely in the miden backend or intrinsic handling. The goal is to make the Miden VM output match Rust's saturating_add and saturating_sub for the max value inputs shown.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
compilers
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。