https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105745

--- Comment #8 from Christoph Reiter <reiter.christoph at gmail dot com> ---
(In reply to Jakub Jelinek from comment #5)
> Ugh, that is a lame limitation.
> Does mingw support any of the other aligned allocators (memalign,
> posix_memalign or aligned_alloc) that can be freed just with free?

I don't think so. There is one internal one in
https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-crt/misc/mingw-aligned-malloc.c
but that has the same limitation afaics.

> If not, I guess easiest fix would be to move the HAVE__ALIGNED_MALLOC
> support as last option before fallback instead of first, make sure
> GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC is not defined for HAVE__ALIGNED_MALLOC if
> no other aligned allocator works and use _aligned_free in gomp_aligned_free
> if
> HAVE__ALIGNED_MALLOC and not GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC.

I went with fixing gomp_aligned_free() and disabling
GOMP_USE_ALIGNED_WORK_SHARES on Windows instead (hoping that in other cases
gomp_aligned_free() is called properly.. (??)). With the goal in mind that this
could be fixed if the alloc/free calls are paired properly in the future.

Feedback welcome, or feel free to take over :)

Reply via email to