This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: On alignment


Jason Merrill writes:
 > On Sat, 22 Mar 2003 09:12:32 +0000 (GMT), Andrew Haley <aph at redhat dot com> wrote:
 > 
 > > Jason Merrill writes:
 > >  > Can you give me an example of a case that needs an aligned attribute?  What
 > >  > is the Java frontend doing that makes this necessary?
 > >
 > > http://gcc.gnu.org/ml/gcc-patches/2003-03/msg00429.html
 > 
 > OK, you're trying to suppress the tail padding optimization.  It occurred
 > to me that another way to express that could be
 > 
 >   struct B : A {
 >     // force normal alignment
 >     char : 0 __attribute ((__aligned (__alignof (A))));
 >     short bs;
 >   };
 > 
 > but of course that doesn't work properly either; user-specified
 > alignment is currently ignored on a zero-length bitfield.  But
 > that's a one-line fix, and shouldn't create a compatibility
 > problem, since there would have been no point in specifying such an
 > alignment before.  Would that work for you?

Excellent.  That's all I need.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]