__udivti3 has a different calling convention than clang.
Open
Nobody has claimed this yet.
A-ABI
C-bug
needs-triage
O-UEFI
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
This is the repository for reproduction. It includes disassembler:
https://github.com/jclab-joseph/rustc-llvm-udivti3-mismatch-problem/blob/main/OUTPUT.txt
I expected to see this happen:
The __udivti3 conventions of C and Rust must be the same.
Instead, this happened:
- In C, rcx, rdx, r8, and r9 (4 * u64s) are used as arguments for __udivti3.
- In Rust, rcx and rdx (2 * pointers) are used as arguments for __udivti3.
This problem occurs when using a library written in C in Rust.
Meta
rustc --version --verbose:
rustc 1.98.0-nightly (4429659e4 2026-06-22)
binary: rustc
commit-hash: 4429659e4745016bd3f26a4a421843edc7fbc422
commit-date: 2026-06-22
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.7
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 linked reproduction and OUTPUT.txt, then trace how rustc and LLVM lower the __udivti3 call for Rust and C on x86_64-unknown-linux-gnu. Done means the generated calling conventions match for the C library integration, with the reproduction showing consistent register and argument usage.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100