This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/60092] posix_memalign not recognized to derive alias and alignment info
- From: "ro at CeBiTec dot Uni-Bielefeld.DE" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Feb 2014 16:40:50 +0000
- Subject: [Bug middle-end/60092] posix_memalign not recognized to derive alias and alignment info
- Auto-submitted: auto-generated
- References: <bug-60092-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60092
--- Comment #23 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to Rainer Orth from comment #21)
>> The new test FAILs on Solaris 11 (both SPARC and x86), which, unlike Solaris
>> 10,
>> has posix_memalign in libc:
>>
>> FAIL: gcc.dg/torture/pr60092.c -O0 execution test
>>
>> The posix_memalign invocation with size = -1 cannot be right, and indeed the
>> function returns ENOMEM.
>
> The invocation uses size -1 intentionally, and expects ENOMEM, but if Solaris
> libc stores to what the first argument points to even when it fails, then it
> violates POSIX.
POSIX.1 doesn't explicitly forbid setting *memptr on error:
http://pubs.opengroup.org/onlinepubs/007904975/functions/posix_memalign.html
But I agree it seems strange, and in the OpenSolaris sources you see
that *memptr is set to the memalign() return value (NULL in this case).
Rainer