\
/* Test whether the alignment argument is valid. It must be \
a power of two multiple of sizeof (void *). */ \
- if (alignment % sizeof (void *) != 0 \
+ if (alignment == 0 \
+ || alignment % sizeof (void *) != 0 \
|| (alignment & (alignment - 1)) != 0) \
return VKI_EINVAL; \
\
# define PM(a,b,c) posix_memalign((void**)a, b, c)
res = PM(&p, -1,100); assert(EINVAL == res);
- res = PM(&p, 0, 100); assert(0 == res && 0 == (long)p % 8);
+ res = PM(&p, 0, 100); assert(EINVAL == res);
res = PM(&p, 1, 100); assert(EINVAL == res);
res = PM(&p, 2, 100); assert(EINVAL == res);
res = PM(&p, 3, 100); assert(EINVAL == res);