https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102838
--- Comment #16 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > Ah, bet Solaris aligned_alloc relies on: > "the value of size shall be an integral multiple of alignment" > (glibc aligned_alloc doesn't). Indeed, cf. aligned_alloc(3C): The alignment argument must be a valid alignment, that is, any power of two (1, 2, 4, 8, ...) and the size argument must be an integral multi- ple of alignment. > Does memalign or posix_memalign rely on that too, or just aligned_alloc? memalign(3C) has: The memalign() function allocates size bytes on a specified alignment boundary and returns a pointer to the allocated block. The value of the returned address is guaranteed to be an even multiple of alignment. The value of alignment must be a power of two and must be greater than or equal to the size of a word. and posix_memalign(3C): The posix_memalign() function allocates size bytes aligned on a bound- ary specified by alignment, and returns a pointer to the allocated mem- ory in memptr. The value of alignment must be a power of two multiple of sizeof(void *). > If just aligned_alloc, we could do incrementally: > 2021-11-17 Jakub Jelinek <ja...@redhat.com> > > PR libgomp/102838 > * alloc.c (gomp_aligned_alloc): Prefer _aligned_alloc over > memalign over posix_memalign over aligned_alloc over fallback > with malloc instead of aligned_alloc over _aligned_alloc over > posix_memalign over memalign over fallback with malloc. For > aligned_alloc, round up size up to multiple of al. That patch worked just fine (only tried on i386-pc-solaris2.11, 32 and 64-bit): all 64-bit failures are gone again. Thanks.