[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 Paul Floyd changed: What|Removed |Added Status|REPORTED|RESOLVED Resolution|--- |FIXED --- Comment #12 from Paul Floyd --- This should now be fixed along with the merges for FreeBSD support. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #11 from Paul Floyd --- The fix for aligned_alloc is likely to land along with support for FreeBSD. I will close this item then. If you feel that there is a strong need for reallocarray please open a new item and I'll take a look. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #10 from Paul Floyd --- Currently, in practice I don't see much benefit in adding reallocarray. The glibc implementation just uses realloc: https://code.woboq.org/userspace/glibc/malloc/reallocarray.c.html So does the FreeBSD implementation: https://github.com/freebsd/freebsd/blob/master/lib/libc/stdlib/reallocarray.c The only difference would be callstacks that are a tiny bit cleaner. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 Paul Floyd changed: What|Removed |Added Assignee|jsew...@acm.org |pa...@free.fr -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #9 from Paul Floyd --- Even more finally, this patch is worthwhile on FreeBSD. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #8 from Paul Floyd --- Finally, I did start writing some regression tests, for instance // example from here https://en.cppreference.com/w/c/memory/aligned_alloc #include #include int main(void) { int *p1 = malloc(10*sizeof *p1); printf("default-aligned addr: %p\n", (void*)p1); free(p1); int *p2 = aligned_alloc(1024, 1024*sizeof *p2); printf("1024-byte aligned addr: %p\n", (void*)p2); if ((size_t)p2 % 1024U) printf("p2 not aligned!\n"); free(p2); } -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #7 from Paul Floyd --- Created attachment 127060 --> https://bugs.kde.org/attachment.cgi?id=127060=edit Patch for algned_alloc support -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #6 from Paul Floyd --- I'll look at reallocarray another day on FreeBSD (not a high priority for me). For aligned_alloc, I don't think that this will work well. The problem is that aligned_alloc and and memalign alias the same function on Linux GNU libc, i.e., paulf> nm /lib64/libc.so.6 | grep align | grep 00081920 00081920 W aligned_alloc 00081920 t __GI___libc_memalign 00081920 T __libc_memalign 00081920 W memalign 00081920 t __memalign Unless I'm much mistaken Valgrind can't redirect from one function address to two different functions. This limits the usefulness to either a libc with separate implementations of memalign/aligned_alloc or a replacement function. In practice this means that aligned_alloc uses will just show up as memaligns. I'll add a patch for this, but it will be of very limited use. I suggest simply updating the docs. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #5 from Paul Floyd --- A more authoritative reference https://en.cppreference.com/w/c/memory/aligned_alloc -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 Paul Floyd changed: What|Removed |Added CC||pa...@free.fr --- Comment #4 from Paul Floyd --- I'll take a look at this. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 Yann Droneaud changed: What|Removed |Added CC||y...@droneaud.fr -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #3 from Yann Droneaud --- More about those functions in glibc documentation: http://www.gnu.org/software/libc/manual/html_node/Summary-of-Malloc.html -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #2 from Yann Droneaud --- (In reply to Yann Droneaud from comment #0) > But it doesn't have explicit support for C11 aligned allocation function: > > - void *aligned_alloc (size_t alignment, size_t size); > Correct link: http://man7.org/linux/man-pages/man3/aligned_alloc.3.html -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 407589] [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
https://bugs.kde.org/show_bug.cgi?id=407589 --- Comment #1 from Yann Droneaud --- (In reply to Yann Droneaud from comment #0) > And GNU reallocate array function: > > - void *reallocarray (void *ptr, size_t nmemb, size_t size); > > http://man7.org/linux/man-pages/man3/reallocarray.3.html It's originally an OpenBSD extension, which is also available at least in FreeBSD and NetBSD OpenBSD: https://man.openbsd.org/reallocarray.3 FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=reallocarray NetBSD: http://netbsd.gw.com/cgi-bin/man-cgi?reallocarray -- You are receiving this mail because: You are watching all bug changes.