public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* attribute aligned(4) ignored
@ 2005-07-26  1:04 Chris Lattner
  2005-07-26  3:22 ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Lattner @ 2005-07-26  1:04 UTC (permalink / raw)
  To: gcc-help


Hi All, I'm trying to reduce the alignment of the double in this structure 
to 4 bytes (from 8) on Darwin.  The goal of doing this is to reduce the 
structure to 12 bytes in size.  Here is my testcase:

struct Test {
   double D __attribute__((aligned(4)));    // only 4 bytes, not 8!
   int X;
};

int X() {
   return sizeof(struct Test);    // Should return 12, not 16.
}

Despite my attempt above, the structure is still 16 bytes in size, due to 
the tail padding required to pad the structure to ensure 8-byte alignment.

Does anyone know how to reduce the alignment of the double, eliminating 
the tail padding?

Thanks,

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-07-26  6:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-26  1:04 attribute aligned(4) ignored Chris Lattner
2005-07-26  3:22 ` Ian Lance Taylor
2005-07-26  4:58   ` Chris Lattner
2005-07-26  5:02     ` corey taylor
2005-07-26  5:04       ` Chris Lattner
2005-07-26  5:25     ` Ian Lance Taylor
2005-07-26  5:57       ` Chris Lattner
2005-07-26  6:27         ` Ian Lance Taylor
2005-07-26  6:44           ` Chris Lattner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).