> OK, I see how the two are different now, but I still don't get why the
> current version is right.  If we say words are 16 bits for simplicity,
> and we're storing VALUE == 0x0001_2345 into a 3-byte BLKmode bitfield,
> surely we want to store 0x01_2345 rather than 0x00_0123?

Why?  If you want this semantics, you need to use a bitfield with integer mode.
In Ada, the following case is frequent: you have a record type with BLKmode and 
an alignment that causes it to padded (because the size is always a multiple 
of the alignment).  You have a field in another record type whose type is the 
first record type but with a representation clause that prescribes the size 
without the padding.  The Ada compiler must accept that.  So the field is made 
a BLKmode bitfield, with DECL_SIZE (size w/o padding) smaller than TYPE_SIZE 
(size w/ padding).  When you're assigning a value to the field, you drop the 
rightmost bytes in memory order, which are junk since padding.

-- 
Eric Botcazou

Reply via email to