Repository navigation
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.
Hey, I ran into some weird crashes that only happened on my old Intel Mac. After some digging found the issue in the
choc::SmallVector.This PR adds a simple fix and minimal test for verifying.
The internal storage is aligned to 8 bytes and sitting at 24 byte offset in the class, so a 16-byte aligned item type is likely to be misaligned.
As far as I know, the max default alignment on arm64 is 8 bytes, so usually not an issue there, but on x86_64 some types need 16 byte-alignment - hence the crashes.
Aligning the internal storage to the alignment of
ElementTypeif it's greater than the ditto foruint64_tfixes it.I have verified by running the tests on Intel. And on silicon the test triggers a ubsan violation without the fix.
Unfortunately, when using
SmallVectorwith a 16-byte aligned type, MSVC warns that the alignment specifier results in padding, so I had to disable that warning. Not ideal, but I couldn't see a way around it.