Skip to content

Avoid alignment-sensitive cast in read_f64_into on AIX#223

Open
amy-kwan wants to merge 2 commits into
BurntSushi:masterfrom
amy-kwan:amyk/update-byteorder-aix
Open

Avoid alignment-sensitive cast in read_f64_into on AIX#223
amy-kwan wants to merge 2 commits into
BurntSushi:masterfrom
amy-kwan:amyk/update-byteorder-aix

Conversation

@amy-kwan
Copy link
Copy Markdown

@amy-kwan amy-kwan commented May 8, 2026

read_f64_into currently reinterprets &mut [f64] as &mut [u64] after asserting that
align_of::<u64>() <= align_of::<f64>(). However, as mentioned in #221,
u64 has a higher alignment than f64 on AIX.

On AIX, this alignment assumption currently causes the function to assert, present when
building byteorder itself, or through crates that rely on byteorder as its dependency. An AIX-specific
workaround is added that decodes f64 values element-by-element.

Note: It is understood that parts of the Rust ecosystem are already moving away from byteorder,
and that this PR may never be accepted upstream. That being said, I am posting this to both
document the issue on AIX and to provide users with a practical short-term way to keep compiling
byteorder and crates that depend on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant