[PATCH] Add support for -funsigned-bitfields

Artyom Skrobov Artyom.Skrobov at arm.com
Thu Jan 30 06:27:27 PST 2014


>> Compatibility with GCC is a means to an end -- we
>> primarily aim to be compatible with GCC in order
>> to make it easy for people to move code between
>> GCC and Clang. Is there some particular code
>> that relies on this? Is there a good reason to
>> think it's better to implement this feature in
>> Clang rather than fixing the code that relies on
>> it?
>
> IIUC, this is in GCC because it was an old RVCT
> feature, and it was so probably because an
> ancient user needed for some obscure reason that
> was only valid on a very narrow embedded context.
>
> Maybe ARM folks can explain the rationale behind
> this on any modern codebase.

Yes, that's indeed a legacy feature of ARM Compiler to default to the "more
efficient" data type, one that doesn't require a sign extension on a fetch.

We have to admit that supporting this feature is more trouble than it's
worth, and it would indeed be preferable to fix the legacy code to use
explicitly-unsigned bitfields.

Thanks for sharing the insight about the non-obvious implications of this
feature.







More information about the cfe-commits mailing list