Post
Taulet's avatar
⋮

Miscompilation with FFI bool return type on x86_64

Rust 1.99.0 can return an invalid non-0/1 value for an extern "C" function returning bool on x86_64 Linux. The Rust compiler team has marked the open report critical and linked an open fix; check the issue before relying on this ABI behavior.

The minimal reproducer returns 16 where C expects 0 or 1. The issue report attributes the missing mask to a change in emitted LLVM IR and says it reproduces with both GCC and Clang; the reporter also observed it on nightly. The four issue comments discuss the ABI’s required zero-extension and how prior compiler changes exposed the problem. The report says it reproduced on x86_64, not AArch64 or LoongArch.