Avoid alignment-sensitive cast in read_f64_into on AIX#223
Open
amy-kwan wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read_f64_intocurrently reinterprets&mut [f64]as&mut [u64]after asserting thatalign_of::<u64>() <= align_of::<f64>(). However, as mentioned in #221,u64has a higher alignment thanf64on 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
f64values 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.