EXTRA_DIST = \
aligned_alloc.vgtest aligned_alloc.stderr.exp \
aligned_alloc.stderr.exp-musl \
+ aligned_alloc.stderr.exp-glibc238 \
brk.stderr.exp brk.vgtest \
capget.vgtest capget.stderr.exp capget.stderr.exp2 capget.stderr.exp3 \
debuginfod-check.stderr.exp debuginfod-check.vgtest.in \
int main(void)
{
-#if defined(MUSL_LIBC)
+#if defined (HAVE_GNU_LIBC_C17_ALIGNED_ALLOC)
char* p = NULL;
+ // zero size
+ p = aligned_alloc(0, 8);
+ assert(p == NULL);
+
+ // non multiple of alignment
+ p = aligned_alloc(8, 25);
+ assert(p && ((size_t)p % 8U == 0U));
+ free(p);
+
+ // align not power of 2
+ p = aligned_alloc(40, 160);
+ assert(p == NULL);
+ errno = 0;
+#endif
+#if defined(MUSL_LIBC)
+ char* p = NULL;
// zero size
p = aligned_alloc(0, 8);
--- /dev/null
+Invalid size value: 25 alignment value: 8 (size should be a multiple of alignment)
+ at 0x........: aligned_alloc (vg_replace_malloc.c:...)
+ by 0x........: main (aligned_alloc.c:16)
+
+Invalid alignment value: 40 (should be a power of 2)
+ at 0x........: aligned_alloc (vg_replace_malloc.c:...)
+ by 0x........: main (aligned_alloc.c:21)
+