On Mon, Oct 24, 2016 at 1:39 PM, Eric Botcazou <ebotca...@adacore.com> wrote:
>> > But integer_truep is just integer_onep for BOOLEAN_TYPEs.
>>
>> Yes, but it's more descriptive IMHO.
>
> At the cost of consistency with fits_to_tree_p though.
>
>> fits_to_tree_p avoids creating an INTEGER_CST in ggc memory and thus is the
>> prefered way to test if you have a wide-int but not yet an INTEGER_CST.
>
> OK, I was confused by int_fits_type_p, which calls it on an INTEGER_CST (which
> now breaks with the additional test in the function).
>
> The attached fix seems to work and passes regression testing (all languages).

Is the change to pass wi::to_widest really necessary?  I think it has a
runtime penalty.

Otherwise ok.

Thanks,
Richard.

>
>         * tree.h (wi::fits_to_tree_p): Accept only 0 and 1 for boolean types.
>         * tree.c (int_fits_type_p): Likewise.  Pass the integer constant as a
>         widest_int to above.
>
> --
> Eric Botcazou

Reply via email to