[PATCH] Define max_align_t in C++11 and C11 mode

Joerg Sonnenberger joerg at britannica.bec.de
Fri Oct 18 15:01:26 PDT 2013


On Fri, Oct 18, 2013 at 10:22:41AM -0700, David Majnemer wrote:
> This implementation of max_align_t disagrees with gcc. They have something
> like:
> typedef struct {
>   long long __max_align_ll __attribute__((__aligned__(__alignof__(long
> long))));
>   long double __max_align_ld __attribute__((__aligned__(__alignof__(long
> double))));
> } max_align_t;
> 
> as their definition while you have something like:
> 
> typedef long double max_align_t;
> 
> For a 32-bit x86 target, this means that:
> gcc's alignof(max_align_t): 8
> clang's alignof(max_align_t): 4

Well, what is it supposed to do in the face of SSE2 registers? For all
basic types, the IA32 ABI mandates at most 32bit alignment. With the
compiler extensions it can certainly be at least 128bit.

Joerg



More information about the cfe-commits mailing list