> Am 18.05.2023 um 19:44 schrieb Eric Botcazou <botca...@adacore.com>:
> 
> 
>> 
>> Would it be better to use
>> 
>>  wi::to_uhwi (wi::to_wide (local->index) - wi::to_wide (local->min_index))
>> 
>> to honor the actual sign of the indices?  I think nothing forbids frontends
>> to use a signed TYPE_DOMAIN here?  But the difference should be always
>> representable in an unsigned value of course.
> 
> We use tree_to_uhwi everywhere else though, see categorize_ctor_elements_1:
> 
>      if (tree_fits_uhwi_p (lo_index) && tree_fits_uhwi_p (hi_index))
>        mult = (tree_to_uhwi (hi_index)
>            - tree_to_uhwi (lo_index) + 1);
> 
> or store_constructor
> 
>            this_node_count = (tree_to_uhwi (hi_index)
>                   - tree_to_uhwi (lo_index) + 1);
> 
> so the proposed form looks better for the sake of consistency.

Ok, thanks for checking.

Richard 

> -- 
> Eric Botcazou
> 
> 

Reply via email to