4 #include "../../../config.h"
8 #if defined (HAVE_GNU_LIBC_C17_ALIGNED_ALLOC)
12 p
= aligned_alloc(0, 8);
15 // non multiple of alignment
16 p
= aligned_alloc(8, 25);
17 assert(p
&& ((size_t)p
% 8U == 0U));
20 // align not power of 2
21 p
= aligned_alloc(40, 160);
25 #if defined(MUSL_LIBC)
29 p
= aligned_alloc(0, 8);
30 assert(p
&& ((size_t)p
% 8U == 0U));
32 // non multiple of alignment passes on FreeBSD
33 p
= aligned_alloc(8, 25);
34 assert(p
&& ((size_t)p
% 8U == 0U));
37 // align not power of 2
38 p
= aligned_alloc(40, 160);
41 // the test below causes a segfault with musl 1.2.2
42 // apparently it has been fixed in 1.2.3
45 if (sizeof(size_t) == 8)
47 p
= aligned_alloc(16, 1UL<<48);
54 assert(p
== NULL
&& errno
== ENOMEM
);