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

Assert on proper alignment in dlmalloc #14634

Merged
merged 5 commits into from
Jul 12, 2021
Merged

Assert on proper alignment in dlmalloc #14634

merged 5 commits into from
Jul 12, 2021

Conversation

kripken
Copy link
Member

@kripken kripken commented Jul 12, 2021

Fixes #10072

@kripken kripken requested a review from sbc100 July 12, 2021 18:15
#endif

#endif // __EMSCRIPTEN__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This same code should be used in emmalloc too?

@@ -62,6 +63,9 @@ extern "C"
// than this will yield an allocation with this much alignment.
#define MALLOC_ALIGNMENT 8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

#define MALLOC_ALIGNMENT alignof(max_align_t)
_Static_assert(alignof(max_align_t) == 8, "max_align_t must be correct");

Note that in C++ you can do alignof rather than __alignof__

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

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.

malloc results are not aligned to alignof(max_align_t)
2 participants