AST codegen: `true as i32` sign-extends the i1, giving -1
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start at the AST cast lowering responsible for bool-to-integer conversions, then inspect the differential suite and its inline mlir! coverage. Verify the example true as i32 through both --legacy-codegen and flat paths; done means both produce 1 and the differential comparison agrees.
Written by the indexing model from the issue text.
Description
The oracle lowers a bool-to-integer cast with a sign extension, so true as i32 is -1. The flat path gives 1.
fn main() -> i32 { let b = true; return b as i32; }
| path | exit |
|---|---|
--legacy-codegen |
255 |
| flat | 1 |
Found while writing a differential test for inline mlir! blocks: a returns : bool block cast to i32 disagreed between the paths for this reason alone. The test avoids the cast. The oracle is the parity reference for the differential suite, so any flat program that casts a bool is currently compared against the wrong number.
Fix: arith.extui for an i1 source in the AST cast lowering.
- Dominant language
- Rust
- Stars
- 14
- Forks
- 2
- Avg merge
- 12h 9m
- Merged PRs (30d)
- 78
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vx-lang/Vx
-
build-ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
build-ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
build-ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
core-lang documentation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
bug codegen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100