[BUG] `af_set_backend` is declared with the wrong parameter width
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
Research direction
Start in src/core/backend.rs:7 and compare af_set_backend with the neighboring declarations in the same extern block. Check include/af/backend.h:24 to confirm the C enum type, update the Rust declaration to match the ABI, then run the repository's Rust checks or tests. Done means the declaration uses the correct parameter width and the checks pass.
Written by the indexing model from the issue text.
Description
extern "C" {
fn af_set_backend(bknd: u8) -> c_int;
The C signature (include/af/backend.h:24) is:
AFAPI af_err af_set_backend(const af_backend bknd);
af_backend is a C enum, i.e. 4-byte int under both MSVC and GCC. Declaring the parameter as u8 is an ABI type mismatch.
In practice it works, because rustc emits zeroext for the u8 argument and the callee reads a clean value from the full register — I checked the IR (declare noundef i32 @af_set_backend(i8 noundef zeroext)). So this is as a latent correctness issue rather than an active bug, but it should still be c_uint to match the C ABI.
The three neighbouring declarations in the same extern block already use c_uint/c_int correctly.
Found by Claude Opus 5.
- Dominant language
- Rust
- Stars
- 827
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
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 arrayfire/arrayfire-rust
-
Bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
arrayfire/arrayfire-rust#387 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
arrayfire/arrayfire-rust#386 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
arrayfire/arrayfire-rust#384 ·
-
Bug
Difficulty 5/5 Over a week Newbie friendliness 35/100
arrayfire/arrayfire-rust#385 · 1 comment ·
-
Bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
arrayfire/arrayfire-rust#382 ·
All issues in arrayfire/arrayfire-rust
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