On Sun, Feb 13, 2011 at 4:22 AM, Laurent Vivier <laur...@vivier.eu> wrote:
> Datatype alignment can be found using following application:
>
> int main(void)
> {
>        printf("alignof(short) %ld\n", __alignof__(short));
>        printf("alignof(int) %ld\n", __alignof__(int));
>        printf("alignof(long) %ld\n", __alignof__(long));
>        printf("alignof(long long) %ld\n", __alignof__(long long));
> }
>
> This patch includes following alignments:
>
> i386
>
>   alignof(short) 2
>   alignof(int) 4
>   alignof(long) 4
>   alignof(long long) 8
>
>  x86_64
>
>   alignof(short) 2
>   alignof(int) 4
>   alignof(long) 8
>   alignof(long long) 8
>
>  arm
>
>   alignof(short) 2
>   alignof(int) 4
>   alignof(long) 4
>   alignof(long long) 4
>
>  m68k (680x0)
>
>   alignof(short) 2
>   alignof(int) 2
>   alignof(long) 2
>   alignof(long long) 2
>
>  mips
>
>   alignof(short) 2
>   alignof(int) 4
>   alignof(long) 4
>   alignof(long long) 8
>
>  ppc
>
>   alignof(short) 2
>   alignof(int) 4
>   alignof(long) 4
>   alignof(long long) 8
>
> for other targets, use by default (2,4,4,8).
>
> Please, update for your favorite target...

For Sparc32 (I think also sparc32plus), the default is OK.

For Sparc64, please use 2, 4, 8, 8. I'd guess other 64 bit platforms
(Alpha, MIPS64, PPC64 etc) should use the same.

Does GCC produce correct code using the attributes on strictly aligned
host, when the target is less strictly aligned?

Should the alignment of floating point variables be specified as well?
The strict alignment required for doubles is 4, but recommended
alignment is 8, I'm not sure which one is used for structures
containing doubles.

Reply via email to