Rust Systems Programming 1 min read

Critical FFI Miscompilation Bug Identified In Rust 1.99.0

Rust version 1.99.0 contains a compiler defect that causes incorrect handling of boolean return values when using foreign function interfaces on x86_64 systems.

Rust version 1.99.0 contains a critical miscompilation bug affecting foreign function interface calls that return boolean values on the x86_64 architecture.

When you invoke a function via FFI and it returns a boolean, the compiler generates incorrect code. The root cause lies in how the compiler handles the calling convention for these return types, meaning the resulting binary fails to correctly interpret or store the returned value.

Code.

This leads to logic errors at runtime, and because the compiler emits no warnings during a successful build, tracking down the resulting execution behavior can be difficult.

If you maintain projects on version 1.99.0, you need to review your external function declarations immediately. Applications that interface with libraries written in other languages and depend on boolean return types are at risk. Until an official fix arrives, you should either avoid using boolean return types in FFI or thoroughly test these specific interfaces to verify they return correct values.