Closed
Description
In C and C++, on x86_64 Linux, alignof(__int128)
is equal to 16
. However, in Rust, align_of::<u128>()
is equal to 8
.
C++: https://gcc.godbolt.org/z/YAq1XC
Rust: https://gcc.godbolt.org/z/QvZeqK
This will cause subtle UB if you ever try to use i128
s across FFI boundaries; for example:
C++: https://gcc.godbolt.org/z/PrtHlp
Rust: https://gcc.godbolt.org/z/_SdVqD
Activity
[-]u128 ABI is incorrect[/-][+]u128 alignment is incorrect on x86_64[/+]leonardo-m commentedon Oct 10, 2018
See also: #54341
nagisa commentedon Oct 10, 2018
Duplicate of #54341, yes.
BOTSML-464: Fix rkyv `u128` aligment issue for ARM architectures.