]> sourceware.org Git - valgrind.git/commitdiff
Linux musl: alligned_alloc accepts alignment of zero
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 5 Mar 2023 15:30:44 +0000 (16:30 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 5 Mar 2023 15:30:44 +0000 (16:30 +0100)
coregrind/m_replacemalloc/vg_replace_malloc.c

index b00d33d497f78c71be60c832cedb1199ab68e8c2..c781da5989e9c7779c847ab4500ae8ea4c856d51 100644 (file)
@@ -1938,6 +1938,11 @@ extern int *___errno (void) __attribute__((weak));
 #define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 0
 #endif
 
+#if defined(MUSL_LIBC)
+#define VG_ALIGNED_ALLOC_SIZE_ZERO 0
+#else
+#define VG_ALIGNED_ALLOC_SIZE_ZERO 1
+#endif
 
 #if defined (VGO_linux) && !defined(MUSL_LIBC)
 
@@ -1979,7 +1984,7 @@ extern int *___errno (void) __attribute__((weak));
        \
        MALLOC_TRACE("aligned_alloc(al %llu, size %llu)", \
                 (ULong)alignment, (ULong)size ); \
-       if (alignment == 0 \
+       if (VG_ALIGNED_ALLOC_SIZE_ZERO && (alignment == 0) \
            || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && (size % alignment != 0)) \
            || (VG_ALIGNED_ALLOC_ALIGN_POWER_TWO && (alignment & (alignment - 1)) != 0) \
            || (VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR && (alignment % 4 != 0))) { \
This page took 0.037264 seconds and 5 git commands to generate.