Eric Botcazou <ebotca...@adacore.com> writes:
>> What's the main potential problem you see?  The backwards condition:
>>
>>     (fieldmode == BLKmode ? BYTES_BIG_ENDIAN : WORDS_BIG_ENDIAN)
>>
>> should apply the same bit-for-bit mapping between source and target
>> as the patch applies.
>
> Not if the objects don't have the same size.

Ugh.

> In Ada we have BLKmode bitfields, i.e. fields whose type has BLKmode
> and whose DECL_SIZE is smaller than the TYPE_SIZE of the type; in this
> case, we want to drop the rightmost bytes in memory order, whatever
> the endianness.

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?  It seems odd
for fieldmode (which I thought was a property of the target) to affect
the interpretation of VALUE (the source).

Richard

Reply via email to