aligned attribute

Maurizio Vitale maurizio.vitale@polymath-solutions.com
Thu Dec 21 21:31:00 GMT 2006


It is certainly reasonable, but if it is true it means that the  
compiler is capable on linux, x86_64 to impose a 16 byte alignment on  
some object for all type of allocations. Then I would expect an  
__attribute__ ((aligned (16)) for a user defined type to be obeyed as  
well.

I haven't tested whether long doubles are actually allocated on 16  
byte boundaries in all case (global, auto and dynamic), mainly  
because the tests would be inconclusive, unless you see an alignment  
< 16.

I just mentioned the data point to see if it did say anything to GCC  
developers.


On Dec 21, 2006, at 4:23 PM, Tim Prince wrote:

> Maurizio Vitale wrote:
>> Thanks. Now to add to my confusion, on my system __alignof(long  
>> double) returns 16, which I presume means that all allocation,  
>> static, dynamic and automatic for long double objects are 16 byte  
>> aligned.
>
> This is a reasonable choice, that long doubles would be aligned for  
> good performance, unless the alignment is over-ridden by a packed  
> or reduced alignment specification.
>
>



More information about the Gcc-help mailing list