0xMiden / 0xMiden/compiler

miscompilation: signed widening arithmetic diverges from native execution

Aberta
#1,288 3 comentários 0 reações 1 responsável Reivindicada por @mooori Ver no GitHub
Linguagem predominante
Rust
Estrelas
115
Forks
84
Merge médio
1d 8h
PRs com merge (30d)
15

Descrição

The differential fuzzing suite found a silent wrong-result miscompilation (no VM abort): a `(u32, u32) -> u32` function mixing `i64.extend8/16/32_s`, `i64.extend_i32_s`, and `i64.mul_wide_s` (one negative-constant and one dynamic multiplicand) returns a different value under the Miden VM than natively.

For inputs `(3022925119, 3340151117)`: native `3550407903` vs MASM `3550391763`.

## Reproduce

On the branch from #1286:

```sh
cargo test -p midenc-integration-tests differential::tests::sext_shapes_repro -- --ignored
```

`sext_shapes_repro` pins the failing input pair and fails deterministically; `sext_shapes` runs the same case under 16 random inputs. The case source is `tests/integration/src/end_to_end/differential/cases/case_sext_shapes.rs`; both tests are `#[ignore]`d in `tests/integration/src/end_to_end/differential/tests.rs`.

## Already bounded

Passing sibling cases show each ingredient is correct in isolation:

- `sext_widths` — pure extend8/16/32_s chains
- `mulwide_dyn` — dynamic-by-dynamic `i64.mul_wide_s`
- `mulwide_fold` — `mul_wide_s` with a *positive* constant multiplicand

The remaining suspects are the negative-constant multiplicand shape (the one piece no passing sibling covers) or an interaction between the shapes.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

O teste que está falhando está em `tests/integration/src/end_to_end/differential/tests.rs` como `sext_shapes_repro`. Examine o caso-fonte `case_sext_shapes.rs` para ver a função que mistura extensões com sinal e multiplicação. Execute o teste para confirmar a divergência e, em seguida, rastreie o tratamento pelo compilador de `i64.extend8/16/32_s`, `i64.extend_i32_s` e `i64.mul_wide_s` com uma constante negativa. Compare o código Miden Assembly gerado com a execução nativa esperada.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
rust
Domínio
compilers
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.