Atrribute packed and aligned causes alignment trap on ERC32 (SPARC v7)

Eljay Love-Jensen eljay@adobe.com
Mon May 30 19:11:00 GMT 2005


Hi Ulf,

In your situation, don't use a C bitfield.

Use a C char for your struct data member, where the lsb (or msb) is your bit of interest, and the other 7 bits are fallow.

On most platforms, a C char is an octet (8 bits).  It has the packing you want, without using GCC-isms to contort a natural machine word (i.e., an int) into unaligned access (as you are doing with your bitfield struct).

Some architectures do not work with unaliagned word access.

HTH,
--Eljay



More information about the Gcc-help mailing list