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 undefined _mm_{malloc,free} with LLVM/MinGW #657

Merged
merged 1 commit into from
Dec 25, 2024
Merged

Conversation

jserv
Copy link
Member

@jserv jserv commented Dec 25, 2024

No description provided.

@jserv jserv requested a review from howjmay as a code owner December 25, 2024 15:29
MinGW defines _mm_{malloc,free} only for x86(-64), but not for Arm.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
@jserv jserv merged commit 21fa0a7 into master Dec 25, 2024
32 checks passed
@jserv jserv deleted the mingw-fixes branch December 25, 2024 15:43
@invertego
Copy link
Collaborator

If an alignment of 1 is passed to _mm_malloc(), this implementation will allocate with malloc() and then _mm_free() will free with _aligned_free(). The latter function is only designed to free memory allocated with an _aligned function.
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-malloc
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-free

I think if you're going to use _aligned_malloc() at all, it needs to be done unconditionally, not just for certain alignments.

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.

2 participants