This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug malloc/20137] aligned_alloc should fail for bad size / alignment [DR#460]
- From: "msebor at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 25 May 2016 14:58:29 +0000
- Subject: [Bug malloc/20137] aligned_alloc should fail for bad size / alignment [DR#460]
- Auto-submitted: auto-generated
- References: <bug-20137-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=20137
--- Comment #5 from Martin Sebor <msebor at redhat dot com> ---
Let me see if Clark remembers why he made the behavior undefined in N1397. The
intent of DR 460 was only to make the function more usable in portable programs
by removing the undefined behavior. I did look at APIs like posix_memalign and
memalign but it didn't occur to me to relax the size constraint even further to
match theirs. I can't think of a reason why the size should be required to be
a multiple of alignment (greater than or equal to it should suffice).
Making this change would also be in line with Clark's C++ overaligned memory
allocation proposal (P0035R1) where the overaligned operator new accepts any
such size, and explicitly calls out using aligned_alloc as a possible (though
not required) implementation.
--
You are receiving this mail because:
You are on the CC list for the bug.