public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Improve DSE to handle stores before __builtin_unreachable ()
Date: Mon, 26 Jun 2023 16:37:12 -0600	[thread overview]
Message-ID: <bb3cee45-1236-b444-de51-5081bdf8442e@gmail.com> (raw)
In-Reply-To: <ZJnI/1HDFDCFo6hs@kam.mff.cuni.cz>



On 6/26/23 11:21, Jan Hubicka wrote:
> Hi,
> playing with testcases for path isolation and const function, I noticed
> that we do not seem to even try to isolate out of range array accesses:
> int a[3]={0,1,2};
> test(int i)
> {
>         if (i > 3)
>           return test2(a[i]);
>         return a[i];
> }
> 
> Here call to test2 is dead, since a[i] will access memory past of the
> array.  We produce a warning:
> 
> t.c:5:24: warning: array subscript 4 is above array bounds of ‘int[3]’ [-Warray-bounds=]
> 
> but we still keep the call:
My recollection is that we'd planned to have those cases call into the 
isolate paths code, but it may not have moved forward -- I lost track of 
that work when I left Red Hat.  I don't think Martin S. is doing GCC 
work anymore, so we'll probably need to update things ourselves.



> 
> Curiously adjusting the testcase:
> 
> const int a[3]={0,1,2};
> test(int i)
> {
>          if (i == 3)
>                  return test2(a[i]);
>          return a[i];
I would guess that we cprop a[i] into a[3] at which point the oob 
reference is painfully obvious and something cleans that up, likely 
before we even get to isolate-paths.


Jeff

  reply	other threads:[~2023-06-26 22:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230620070009.C11983858D1E@sourceware.org>
2023-06-20 13:27 ` Jeff Law
2023-06-21  6:41   ` Richard Biener
2023-06-21  9:55     ` Jan Hubicka
2023-06-21 14:04     ` Jeff Law
2023-06-22  6:31       ` Richard Biener
2023-06-22 13:36         ` Jeff Law
2023-06-22 13:42           ` Jan Hubicka
2023-06-24 14:24             ` Jeff Law
2023-06-25 16:33               ` Jan Hubicka
2023-06-26 17:21   ` Jan Hubicka
2023-06-26 22:37     ` Jeff Law [this message]
2023-06-20  6:59 Richard Biener

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=bb3cee45-1236-b444-de51-5081bdf8442e@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=rguenther@suse.de \
    /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).