Skip to content

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
_Static_assert(MALLOC_ALIGNMENT == 8, "max_align_t must be 8");
#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?


// Configuration: specifies the minimum alignment that malloc()ed memory outputs. Allocation requests with smaller alignment
// 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)

3 participants