Minimum target alignment for a datatype
Chris Lattner
CLATTNER@apple.com
Fri Jul 22 20:41:00 GMT 2005
On Jul 22, 2005, at 12:42 PM, Andrew Pinski wrote:
>> struct X { int A; double B; };
>>
>> This is modified by things like ADJUST_FIELD_ALIGN and
>> ROUND_TYPE_ALIGN. As such, I don't think there is a way to get this
>> alignment in a target-independent way. Does that sound right?
>>
>
> You want the alignment of B in that struct in source code and not
> in GCC?
> If so you want to do:
> struct X { int A; double B; };
> int f(void){struct X b; return __alignof__(b.B);}
Nope, I'm trying to use this in target-independent GCC code, not
source code. The reason I can't do something like the above (which
amounts to looking at TYPE_ALIGN or DECL_ALIGN) is that I don't
*know* all the ways that double can be used, and how the target will
change its alignment. IOW, I'm looking for
give_me_the_minimum_alignment(double), which, on darwin, because of
the above, is 4 bytes.
As RTH pointed out, it appears that there is no interesting minimum
that I can get.
Thanks all,
-Chris
More information about the Gcc
mailing list