public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Eric Botcazou <botcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix internal error on small array with negative lower bound
Date: Thu, 18 May 2023 20:24:48 +0200	[thread overview]
Message-ID: <1623D788-786F-474C-9BBC-80EBF576AB0D@gmail.com> (raw)
In-Reply-To: <1897759.taCxCBeP46@fomalhaut>



> Am 18.05.2023 um 19:44 schrieb Eric Botcazou <botcazou@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	other threads:[~2023-05-18 18:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18  9:28 Eric Botcazou
2023-05-18 12:02 ` Richard Biener
2023-05-18 17:44   ` Eric Botcazou
2023-05-18 18:24     ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1623D788-786F-474C-9BBC-80EBF576AB0D@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=botcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).