Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for clang and gcc optimization build crash #79

Closed
wants to merge 4 commits into from

Conversation

topin89
Copy link

@topin89 topin89 commented Jul 12, 2019

Detailed version is in this issue:
#77

In short, at least clang 8 and 8.3 optimize code in such a way than it should be aligned more than default malloc \ new alignment (that is alignof(max_align_t), typically 8).

Since the code targets C++11, we can either use platform_specific functions like posix_memalign and _aligned_malloc, or we can overallocate and use standard std::align to get address with desired alignment.

I choose latter for cross-platform and because I don't know how it works for consoles, so we now allocate size(T) + alignof(T) + sizeof(Header), and Header now also stores original pointer from malloc.

@topin89
Copy link
Author

topin89 commented Jul 13, 2019

Since fixed here: c81a023 I suppose this can be closed unless Alloc should be used for any arbitrary objects with arbitrary alignments.

@topin89 topin89 closed this Jul 13, 2019
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