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: Ping : H8/300 ABI Document


Anil Paranjape wrote:
Structure Alignment
Unless __attribute__ ((packed)) is attached to the declaration of a struct, each structure member is aligned to a multiple of 2 bytes on H8/300 and of 4 bytes on H8/300H and H8S.

This is a maximum. Fields get natural alignment (alignment same as size) up to this maximum. So shorts are always 2 byte aligned, but 4-byte ints get 2-byte alignment on H8/300 and 4-byte alignment on H8S.


Structure alignment is the max of the alignment of all fields.

Your suggested wording is not correct. The structure in your example still has only 2-byte alignment even whwn compiled for H8S.
.comm _t,4,2
gives it a 4-byte size and 2-byte alignment. This is because shorts always have 2-byte alignment.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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