This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Minimum target alignment for a datatype
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: CLATTNER at apple dot com (Chris Lattner)
- Cc: gcc at gcc dot gnu dot org, mrs at apple dot com (Mike Stump)
- Date: Fri, 22 Jul 2005 15:42:23 -0400 (EDT)
- Subject: Re: Minimum target alignment for a datatype
> > I'm having a hard time with the simplicity of your question:
> > ? Certainly, I don't expect that to answer your question, but I
> > don't understand why.
>
> The problem I am running into is that the double in this struct is
> only 4-byte aligned on darwin:
>
> 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);}
-- Pinski