miscompiling i32 overflow
Open
Nobody has claimed this yet.
bug
GCC
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 230
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
https://rust.godbolt.org/z/coK3hz5aE
pub fn f(a: i32) -> i32 {
if a + 1 == -0x80000000i32 {
1
} else {
0
}
}
is miscompiled to:
__f:
xorl %eax, %eax
ret
Contributor guide
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.
Research direction
Start with the Rust example and compiler output in the linked Godbolt case. Reproduce the function and compare its generated assembly with the expected behavior for i32 overflow. Done means the compiler no longer reduces this case to an unconditional zero result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100