Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALS3df3pwaUmZ=brjqgfhyz8bQS5c-L86YUvO12bmS+QOVE1nw@mail.gmail.com>
Date: Sun, 4 May 2014 13:42:05 +0200
From: Paweł Dziepak <pdziepak@...rnos.org>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] add definition of max_align_t to stddef.h

2014-05-01 0:43 GMT+02:00 Rich Felker <dalias@...c.org>:
> On Wed, Apr 30, 2014 at 11:42:51PM +0200, Szabolcs Nagy wrote:
>> * Pawel Dziepak <pdziepak@...rnos.org> [2014-04-30 22:23:01 +0200]:
>> >
>> > +TYPEDEF union { long double ld; long long ll; } max_align_t;
>>
>> this is wrong
>>
>> - ld and ll identifiers are not reserved for the implementation
>> (you could name them _ld, _ll or __ld, __ll etc)
>
> It's also not clear to me why this should go in alltypes.h. Unless it
> needs to be arch-specific, it could go directly in stddef.h.
>
>> and see previous max_align_t discussion
>> http://www.openwall.com/lists/musl/2014/04/28/8
>>
>> - compiler implementations are non-conforming on some platforms
>> (_Alignof returns inconsistent results for the same object type so
>> reasoning about alignments is problematic, there are exceptions
>> where this is allowed in c++11 but not in c11)
>
> Is there a bug filed against gcc yet?

The behavior in GCC 4.9 has changed. _Alignof(long long) now is always
4. _Alignof(max_align_t) remains 8 though. Because of this, the
solution I proposed in earlier post doesn't work anymore
(_Alignof(max_align_t) would be 4 if GCC 4.9 didn't complain that
_Alignas(long long) reduces alignment of long long which is weird but
probably doesn't matters much in this discussion) and I looks like the
only option is to use __attribute__((__aligned__(...))). I don't think
there is reason for me to send another version of this patch since
there has already been sent a patch which defines max_align_t in such
way.

Paweł

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.