This is the mail archive of the gcc-patches@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: [PATCH] PR50325 store_bit_field: Fix for big endian targets


Eric Botcazou <ebotcazou@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


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