Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jul 2016 15:55:12 -0500
From:      Pedro Giffuni <pfg@FreeBSD.org>
To:        cem@freebsd.org, "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
Cc:        Dimitry Andric <dim@freebsd.org>, Roman Divacky <rdivacky@freebsd.org>, FreeBSD current <freebsd-current@freebsd.org>
Subject:   Re: clang 3.3/3.4 fails to build items that use stdlib.h because of __alloc_size attribute assigned to posix_memalign
Message-ID:  <647ae486-0639-715e-4fc2-28590295f816@FreeBSD.org>
In-Reply-To: <3a288119-81f5-9199-b9d4-0f4649a7b8eb@FreeBSD.org>
References:  <838A69F7-343D-4398-928B-E54FB966B574@gmail.com> <CAG6CVpXHK1J7vvR1LgFLs_fGyoZTTVw1Jput5xswKRSeYHEquw@mail.gmail.com> <3a288119-81f5-9199-b9d4-0f4649a7b8eb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Answering to myself ....

On 07/05/16 15:24, Pedro Giffuni wrote:
> Hmm ...
>
> On 07/05/16 15:14, Conrad Meyer wrote:
>> Whoops, missed reply-all the first time.
>>
>> It seems pretty clear that alloc_size (return value is a memory
>> allocation of size from parameter N) does not apply to posix_memalign,
>> because posix_memalign's allocation is stored via a pointer argument
>> rather than return value.
>>
>> https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
>>
>>
>> IMO the attribute should be removed from posix_memalign in stdlib.h
>>
>> Best,
>> Conrad
>>
>
> - I am wondering why it hasn't affected -current if it is wrong.

Because newer clang removed alloc_size altogether.

> - I am also wondering if we shouldn't just get rid of the attribute.
>

Nah, it is basically meant for FORTIFY_SOURCE, which is not being
worked on anymore but maybe handy some day.

> I will answer to myself those doubts and fix the issue. Thanks!
>

So, yes, we should remove it from posix_memalign(). I'll ask re@.

Pedro.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?647ae486-0639-715e-4fc2-28590295f816>