[patch] Correctly align arrays of int64_t on 32 bit systems

Richard Smith richard at metafoo.co.uk
Wed Aug 7 17:04:12 PDT 2013


On Wed, Aug 7, 2013 at 2:58 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> > Should foo[n] really return different results depending on the value of
> > n? That feels wrong to me.
>
> This is (and was) the odd case for x86_64. We accept but gcc rejects this
>
> -----------------------------
> long long int foo[1];
> long long int bar[2];
>
> static_assert(alignof(foo) == 8, "foo");
> static_assert(alignof(bar) == 16, "bar");
> -----------------------------
>
> Richard, gcc is correct in here, right?


To quote Clang, 'alignof' applied to an expression is a GNU extension. Thus
we should presumably do what GCC does -- C++ doesn't have a notion of the
alignment of a declaration as distinct from the alignment of its type.


> If so I can try to code a
> patch replacing RefAsPointee with a more generic ForAlignof.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130807/bd468799/attachment.html>


More information about the cfe-commits mailing list