https://bugs.kde.org/show_bug.cgi?id=474332
--- Comment #5 from Stefano Bonicatti <[email protected]> --- (In reply to Paul Floyd from comment #4) > Should be fixed with this. Tested in Debian with an older libc, ArchLinux > latest and FreeBSD. > > commit ae413f79b24de558ac9ab925babd1fb86e0d21c7 (HEAD -> master, > origin/users/paulf/try-bug474332, origin/master, origin/HEAD, bug474332) > Author: Paul Floyd <[email protected]> > Date: Sun Sep 10 15:05:57 2023 +0200 > > Bug 474332 - aligned_alloc under Valgrind returns nullptr when alignment > is not a multiple of sizeof(void *) > > At configure time use glibc version to set a HAVE flag for C17 > aligned_alloc. > The use the HAVE flag to select which redir macro to use. > Also make the (normally unused) glibc ALIGNED_ALLOC macro Thanks for such quick turnaround! A question though, I built the new version and now the behavior of aligned_alloc with an alignment that is not a power of 2 is not consistent with glibc, meaning that Valgrind succeeds and glibc fails. ==68409== Memcheck, a memory error detector ==68409== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==68409== Using Valgrind-3.22.0.GIT and LibVEX; rerun with -h for copyright info ==68409== Command: ./test2 ==68409== ==68409== Invalid alignment value: 3 (should be a power of 2) ==68409== at 0x4848D47: aligned_alloc (vg_replace_malloc.c:2242) ==68409== by 0x10915F: main (in /home/smjert/Development/test-valgrind/test2) ==68409== Allocation succeeded! While Valgrind does report that an alignment of 3 is incorrect, shouldn't it also fail the allocation, to not change the program behavior (at least in this case where Valgrind can emulate glibc easily)? Again this is what glibc does: https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c;h=e2f1a615a4fc7b036e188a28de9cfb132b2351df;hb=36f2487f13e3540be9ee0fb51876b1da72176d3f#l3548 -- You are receiving this mail because: You are watching all bug changes.
