Open
Description
Code
use std::arch::x86_64::__m128;
extern
{
fn f(_: *const __m128);
}
Current output
warning: `extern` block uses type `__m128`, which is not FFI-safe
--> <source>:5:13
|
5 | fn f(_: *const __m128);
| ^^^^^^^^^^^^^ not FFI-safe
|
= help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
= note: this struct has unspecified layout
= note: `#[warn(improper_ctypes)]` on by default
Desired output
Rationale and extra context
I don’t see why passing *const __m128
over FFI could cause ABI problems (as opposed to passing __m128
by value, which is known to miscompile). C and Rust agree on the size and alignment of __m128
, and for extern
functions, on the argument passing convention for pointers.
Other cases
Rust Version
rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.84.0
LLVM version: 19.1.5
Anything else?
No response