From: Jeff Law <law@redhat.com>
To: Martin Sebor <msebor@gmail.com>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)
Date: Mon, 8 Feb 2021 12:59:37 -0700 [thread overview]
Message-ID: <55235bab-1a5a-4e3b-3a57-55d9a84ae00c@redhat.com> (raw)
In-Reply-To: <7fa3c1e0-8a09-3436-8669-6d1a577ca247@gmail.com>
On 1/19/21 5:56 PM, Martin Sebor via Gcc-patches wrote:
> Similar to the problem reported for -Wstringop-overflow in pr98266
> and already fixed, -Warray-bounds is also susceptible to false
> positives in assignments and copies involving virtual inheritance.
> Because the two warnings don't share code yet (hopefully in GCC 12)
> the attached patch adds its own workaround for this problem to
> gimple-array-bounds.cc, this one slightly more crude because of
> the limited insight the array bounds checking has into the checked
> expressions.
>
> Tested on x86_64-linux.
>
> Martin
>
> gcc-98266.diff
>
> PR middle-end/98266 - bogus array subscript is partly outside array bounds on virtual inheritance
>
> gcc/ChangeLog:
>
> PR middle-end/98266
> * gimple-array-bounds.cc (array_bounds_checker::check_array_bounds):
> Avoid checking references involving artificial members.
>
> gcc/testsuite/ChangeLog:
>
> PR middle-end/98266
> * g++.dg/warn/Warray-bounds-15.C: New test.
It seems to me that we've got the full statement at some point and thus
the full expression so at some point couldn't we detect when
TYPE_SIZE_UNIT!= DECL_SIZE_UNIT? Or should we be using TYPE_SIZE_UNIT
rather than DECL_SIZE_UNIT in gimple-array-bounds.cc
Am I missing something?
jeff
next prev parent reply other threads:[~2021-02-08 19:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 0:56 Martin Sebor
2021-01-29 17:22 ` PING " Martin Sebor
2021-02-06 17:12 ` PING 2 " Martin Sebor
2021-02-08 19:59 ` Jeff Law [this message]
2021-02-08 21:56 ` Martin Sebor
2021-02-08 22:26 ` Jeff Law
2021-02-08 22:44 ` Martin Sebor
2021-02-08 23:11 ` Jeff Law
2021-02-09 17:49 ` Martin Sebor
2021-02-23 16:02 ` PING " Martin Sebor
2021-02-23 21:52 ` Jason Merrill
2021-02-23 23:07 ` Martin Sebor
2021-02-25 0:35 ` Jason Merrill
2021-03-01 23:11 ` Martin Sebor
2021-03-02 14:11 ` Jason Merrill
2021-03-03 23:20 ` Martin Sebor
2021-03-04 5:33 ` Jason Merrill
2021-03-04 17:44 ` Martin Sebor
2021-03-04 20:00 ` Jason Merrill
2021-02-25 23:47 ` Jeff Law
2021-02-26 3:56 ` Jason Merrill
2021-02-25 23:40 ` Jeff Law
2021-03-01 23:16 ` Martin Sebor
2021-02-25 23:15 ` 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=55235bab-1a5a-4e3b-3a57-55d9a84ae00c@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=msebor@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).