Re: attribute aligned(4) ignored

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Lattner <sabre@xxxxxxxxxx> writes:

> > How about
> >
> >   double D __attribute__((aligned(4), packed));
> 
> This is exactly the sort of thing I want to do.  My structs can be
> arbitrarily complex, and can have a bunch of stuff in them that should
> not be packed.  This means that I don't want to use attribute packed
> on the structure itself, but using it on the member would be fine.
> 
> However, when I try this:
> 
> struct Test {
>    double D __attribute__((packed,aligned(4)));
>    short X;
> };
> 
> ... the struct maintains its 8-byte alignment even though nothing
> inside of it requires 8-byte alignment any more.

When I try that with a powerpc-eabi compiler, it appears to generates
a struct with a size of 12 bytes and an alignment of 4 bytes.  Do you
not see that with a Darwin compiler?  What target are you configuring
for?  What sources are you using?

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux