On 3/16/23 13:48, DJ Delorie via Libc-alpha wrote:
+ /* Similar to memalign, but ISO C17 requires an error for invalid + alignments. Valid alignments are non-negative powers of two. */ + if (!powerof2 (alignment))
powerof2 (0) == 1, unfortunately. Does the C standard let aligned_alloc (alignment, size) succeed when ALIGNMENT is zero? I think not, as zero is 2**-Infinity, and -Infinity is not non-negative. So that line should be changed to something like 'if (!powerof2 (alignment) || alignment == 0)'.
There may be other occurrences of this issue in Glibc already; I haven't checked.