rust-lang / rust-lang/rustc_codegen_gcc
Possible bug in 128-bit integers implementation (gcc_checked_binop)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 105
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 14
Description
It seems there's a mixup between the overflow flag and the result of the operation from what we could see here.
The code that might be wrong is here.
For instance __mulosi4 has the following signature:
si_int __mulosi4(si_int a, si_int b, int *overflow);
while __builtin_mul_overflow has:
bool __builtin_mul_overflow (type1 a, type2 b, type3 *res)
Yet, they seem to be called the same way (mixing up overflow with the return value of res with the other return value).
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
Read src/int.rs around lines 278-364, then compare the referenced compiler-rt __mulosi4 and GCC __builtin_mul_overflow signatures and calling conventions. Trace how the overflow flag and operation result are passed through gcc_checked_binop, and confirm the implementation distinguishes the two APIs correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100