> 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.

-- 
Eric Botcazou


Reply via email to