This is the mail archive of the gcc-help@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] | |
Chris Lattner <sabre@nondot.org> writes: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?
How about
double D __attribute__((aligned(4), packed));
struct Test {
double D __attribute__((packed,aligned(4)));
short X;
};-- http://nondot.org/sabre/ http://llvm.org/
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |