On Wed, Nov 25, 2015 at 5:09 PM, Paolo Carlini <paolo.carl...@oracle.com> wrote:
> Hi,
>
> On 11/25/2015 04:59 PM, Markus Trippelsdorf wrote:
>>>
>>> Index: cp/constexpr.c
>>> ===================================================================
>>> --- cp/constexpr.c      (revision 230865)
>>> +++ cp/constexpr.c      (working copy)
>>> @@ -1799,8 +1799,8 @@ cxx_eval_array_reference (const constexpr_ctx *ctx
>>>         gcc_unreachable ();
>>>       }
>>>   -  i = tree_to_shwi (index);
>>> -  if (i < 0)
>>> +  if (!tree_fits_shwi_p (index)
>>> +      || (i = tree_to_shwi (index)) < 0)
>>
>> Last time Richard pointed out that:
>>      if (wi::lts_p (index, 0))
>> is more idiomatic.
>
> I see, but isn't used anywhere else in the whole cp/ and in the case at
> issue we still need to assign to 'i', thus I would rather follow the
> existing practice in the front-end...

You can also use tree_int_cst_sgn (index) == -1 (which uses wi::neg_p
(index) internally).

Richard.

> Paolo.

Reply via email to