On Windows/MSVC, I get an abort() on line 85:

  ASSERT (((uintptr_t) aligned16_blocks[i] % 16) == 0);

m4/malloc-align.m4 indicates that MALLOC_ALIGN should
be 8 or 16. But all (?) Windows targets do have the
'_aligned_malloc()' [1] function which is found nowhere.

So patching like this, test-aligned-malloc succeeds:

--- a/lib/aligned-malloc.h 2020-07-26 18:38:46
+++ b/lib/aligned-malloc.h 2020-10-19 12:00:40
@@ -117,8 +117,29 @@
 {
   free (q);
 }
+# endif
+
+# elif HAVE__ALIGNED_MALLOC          /* MSVC, clang, MinGW */
+/* Use _aligned_malloc().  */
+
+#include <malloc.h>
+
+static inline void *
+aligned_malloc (size_t size)
+{
+  return _aligned_malloc (size, ALIGNMENT);
+}
+
+# ifdef aligned_free
+   /* The caller wants an inline function, not a macro.  */
+static inline void
+aligned_free (void *q)
+{
+  _aligned_free (q);
+}
+
 # else
-#  define aligned_free free
+#  define aligned_free _aligned_free
 # endif

 #else

-----

And having:
  #define MALLOC_ALIGNMENT      8   /* 2*sizeof(void*) in my case */
  #define HAVE__ALIGNED_MALLOC  1

in my 'config.h'.

[1]: 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/aligned-malloc?view=vs-2019

--
--gv

Reply via email to