Hi Gisle,

> On Windows/MSVC, I get an abort() on line 85:
> 
>    ASSERT (((uintptr_t) aligned16_blocks[i] % 16) == 0);

Works fine for me, with MSVC 14, in all possible combinations
(32 bit and 64 bit, with and without -MD).

> m4/malloc-align.m4 indicates that MALLOC_ALIGN should
> be 8 or 16.

Yes, MALLOC_ALIGN should be = 2 * sizeof (void*).

>    #define MALLOC_ALIGNMENT      8   /* 2*sizeof(void*) in my case */

Can you investigate this assertion failure? I mean, for the alignment 16
 > MALLOC_ALIGNMENT, the code is supposed to use code branch
  /* Use malloc and waste a bit of memory.  */
and this implementation cannot return a value that is not a multiple of 16.

Does the problem persist when you reduce the optimization options?

> But all (?) Windows targets do have the
> '_aligned_malloc()' [1] function which is found nowhere.

_aligned_malloc is a "Use malloc and waste a bit of memory" implementation
as well. Nothing more fancy or more efficient. It's equivalent to the one
I coded in aligned-malloc.h lines 127..167, just with fewer assertions and
thus more dangerous to use if someone makes programming mistakes.

Bruno


Reply via email to