Hi,
Ada supports arrays with negative indices, although the internal index type is
sizetype like in other languages, which is unsigned. This means that negative
values are represented by very large numbers, which works with a bit of care.
The attached test exposes a small loophole in output_const
On Thu, May 18, 2023 at 11:51 AM Eric Botcazou via Gcc-patches
wrote:
>
> Hi,
>
> Ada supports arrays with negative indices, although the internal index type is
> sizetype like in other languages, which is unsigned. This means that negative
> values are represented by very large numbers, which wo
> 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
> Am 18.05.2023 um 19:44 schrieb Eric Botcazou :
>
>
>>
>> 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