Hmm, the fact that it hits the code at the bottom of aligned_alloc probably doesn't help!
Code: Select all
void *aligned_alloc(size_t align, size_t size)
{
/* align must be a power of 2 */
/* size must be a multiple of align */
if ((align & (align - 1)) || (size & (align - 1)))
{
errno = EINVAL;
return NULL;
}
#ifdef HAVE_POSIX_MEMALIGN
if (align < sizeof (void *)) /* POSIX does not allow small alignment */
align = sizeof (void *);
void *ptr;
int err = posix_memalign(&ptr, align, size);
if (err)
{
errno = err;
ptr = NULL;
}
return ptr;
#elif !defined (_WIN32)
return memalign(align, size);
#else
#ifdef __MINGW32__
return __mingw_aligned_malloc(size, align);
#elif defined(_MSC_VER)
return _aligned_malloc(size, align);
#endif
if (size > 0)
errno = ENOMEM;
return NULL;
#endif
}
Adding the following lines in the section at the bottom allows it to get further...
Code: Select all
#ifdef __MINGW32__
return __mingw_aligned_malloc(size, align);
#elif defined(_MSC_VER)
return _aligned_malloc(size, align);
#endif
...but still crashes.
But the 17th June commit relating to aligned_malloc definitely screws things up.