[PATCH, GCC/ARM] Make arm_feature_set agree with type of FL_* macros

Thomas Preudhomme thomas.preudhomme@foss.arm.com
Mon Nov 14 18:51:00 GMT 2016


Hi Christophe,

No, they were seen when bootstrapping on arm-linux-gnueabihf with the patch to 
to make -mthumb optional. The patch store flags in an arm_feature_set array and 
GCC -Wnarrowing complained about the difference of type.

Best regards,

Thomas

On 14/11/16 17:00, Christophe Lyon wrote:
> Hi,
>
>
> On 14 November 2016 at 15:07, Thomas Preudhomme
> <thomas.preudhomme@foss.arm.com> wrote:
>> Hi,
>>
>> Currently arm_feature_set is defined in gcc/config/arm/arm-flags as an array
>> of 2 unsigned long. However, the flags stored in these two entries are
>> (signed) int, being combinations of bits set via expression of the form 1 <<
>> bitno. This creates 3 issues:
>>
>> 1) undefined behavior when setting the msb (1 << 31)
>> 2) undefined behavior when storing a flag with msb set (negative int) into
>> one of the unsigned array entries (positive int)
>
> Just curious: are these problems seen when building with ubsan enabled?
>
>> 3) waste of space since the top 32 bits of each entry is not used
>>
>> This patch changes the definition of FL_* macro to be unsigned int by using
>> the form 1U << bitno instead and changes the definition of arm_feature_set
>> to be an array of 2 unsigned (int) entries.
>>
>> Bootstrapped on arm-linux-gnueabihf targeting Thumb-2 state.
>>
>> Is this ok for trunk?
>>
>> Best regards,
>>
>> Thomas



More information about the Gcc-patches mailing list