src/core/backend.rs:7:
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.
src/core/backend.rs:7:The C signature (
include/af/backend.h:24) is:af_backendis a C enum, i.e. 4-byteintunder both MSVC and GCC. Declaring the parameter asu8is an ABI type mismatch.In practice it works, because rustc emits
zeroextfor theu8argument 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 bec_uintto match the C ABI.The three neighbouring declarations in the same
externblock already usec_uint/c_intcorrectly.Found by Claude Opus 5.