public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Martin Sebor <msebor@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PR tree-optimization/84047] missing -Warray-bounds on an out-of-bounds index
Date: Tue, 30 Jan 2018 23:37:00 -0000	[thread overview]
Message-ID: <c9d31f46-e4b7-e197-f4ef-9334571649df@gmail.com> (raw)
In-Reply-To: <9a52975c-c720-f42f-3564-7b69e361487d@redhat.com>

On 01/30/2018 03:11 PM, Aldy Hernandez wrote:
> Hi!
>
> [Note: Jakub has mentioned that missing -Warray-bounds regressions
> should be punted to GCC 9.  I think this particular one is easy
> pickings, but if this and/or the rest of the -Warray-bounds regressions
> should be marked as GCC 9 material, please let me know so we can adjust
> all relevant PRs.]

Let me first say that I have no concern with adopting this
patch for GCC 8 (and older) and deferring more comprehensive
solutions for the remaining regressions until GCC 9.

With that said, as we discussed last week in IRC, the patch
I submitted for one of these regressions, bug 83776, also
happens to fix one of the two test cases submitted for this
bug:

   https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02144.html

I put the patch together because it's a P2 bug and has a Target
Milestone set to 6.5.  I took that to mean that it's expected
to be fixed in 8.1 in addition to 7.x and 6.x, but in light of
Jakub's reservations and Ady's question above I'm not sure my
understanding is correct, or if it is, that there necessarily
is consensus to fix them in GCC 8.

I also spent some time over the weekend extending my patch to
handle the additional test case from comment #2 on bug 84047.
That one is also due to the same underlying root cause.  I'm
close to done with it but I had to set it aside to handle
a bug in my own code that was reported yesterday.

I mention this because I too would find it helpful if it were
made clear whether these regressions are expected to be fixed
in GCC 8, so we can focus on the right bugs and avoid
duplicating effort.  If we want to fix all the reported
-Warray-bounds regressions in GCC 8 then I'll finish my patch
in progress and post it as a followup.

Martin

>
> This is a -Warray-bounds regression that happens because the IL now has
> an MEM_REF instead on ARRAY_REF.
>
> Previously we had an ARRAY_REF we could diagnose:
>
>   D.2720_5 = "12345678"[1073741824];
>
> But now this is represented as:
>
>   _1 = MEM[(const char *)"12345678" + 1073741824B];
>
> I think we can just allow check_array_bounds() to handle MEM_REF's and
> everything should just work.
>
> The attached patch fixes both regressions mentioned in the PR.
>
> Tested on x86-64 Linux.
>
> OK?

  reply	other threads:[~2018-01-30 23:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 22:43 Aldy Hernandez
2018-01-30 23:37 ` Martin Sebor [this message]
2018-01-31 11:43 ` Richard Biener
2018-02-01 17:42   ` Aldy Hernandez
2018-02-08 10:38     ` Richard Biener
2018-02-08 20:45       ` Martin Sebor
2018-02-14 12:30         ` Richard Biener
2018-02-13 22:58       ` Jeff Law

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=c9d31f46-e4b7-e197-f4ef-9334571649df@gmail.com \
    --to=msebor@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=msebor@redhat.com \
    --cc=richard.guenther@gmail.com \
    /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).