On Sat, 25 Feb 2023 at 17:29, Steffen Nurpmeso <[email protected]> wrote: > > Ed Maste wrote in > <capyfy2a-dnbrivwzifojv4syl9qyxvozx2sk-bcd9pedf30...@mail.gmail.com>: > |On Fri, 24 Feb 2023 at 20:27, Steffen Nurpmeso <[email protected]> wrote: > |> Me too. 'Was just thinking of allocators which give back valid > |> but inaccessible memory for 0 bytes so that each access would > |> fault. > | > |The size is not (necessarily) zero though. The alignment requested is. > > I personally would fail EINVAL for 0: something really must be > bogus if you reqest an alignment of 0. The standard says > > Upon successful completion, posix_memalign( ) shall return zero;
This is not posix_memalign, this is memalign which is provided for glibc compatibility (and which accepts align == 0). This came up only because Valgrind's tests triggered this case.
