From: Richard Biener <richard.guenther@gmail.com>
To: Martin Sebor <msebor@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] add access warning pass
Date: Wed, 28 Jul 2021 11:23:43 +0200 [thread overview]
Message-ID: <CAFiYyc2oVOAEmADy3kCEh0WLVaO1vMWoXDJPUs7dOQo9VrVPtw@mail.gmail.com> (raw)
In-Reply-To: <bfd140bd-66e3-0642-992b-1d975265fdb1@gmail.com>
On Fri, Jul 16, 2021 at 12:42 AM Martin Sebor via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> A number of access warnings as well as their supporting
> infrastructure (compute_objsize et al.) are implemented in
> builtins.{c,h} where they (mostly) operate on trees and run
> just before RTL expansion.
>
> This setup may have made sense initially when the warnings were
> very simple and didn't perform any CFG analysis, but it's becoming
> a liability. The code has grown both in size and in complexity,
> might need to examine the CFG to improve detection, and in some
> cases might achieve a better S/R ratio if run earlier. Running
> the warning code on trees is also slower because it doesn't
> benefit from the SSA_NAME caching provided by the pointer_query
> class. Finally, having the code there is also an impediment to
> maintainability as warnings and builtin expansion are unrelated
> to each other and contributors to one area shouldn't need to wade
> through unrelated code (similar for patch reviewers).
>
> The attached change introduces a new warning pass and a couple of
> new source and headers and, as the first step, moves the warning
> code from builtins.{c,h} there. To keep the initial changes as
> simple as possible the pass only runs a subset of existing
> warnings: -Wfree-nonheap-object, -Wmismatched-dealloc, and
> -Wmismatched-new-delete. The others (-Wstringop-overflow and
> -Wstringop-overread) still run on the tree representation and
> are still invoked from builtins.c or elsewhere.
>
> The changes have no functional impact either on codegen or on
> warnings. I tested them on x86_64-linux.
>
> As the next step I plan to change the -Wstringop-overflow and
> -Wstringop-overread code to run on the GIMPLE IL in the new pass
> instead of on trees in builtins.c.
That's the maybe_warn_rdwr_sizes thing?
+ gimple *stmt = gsi_stmt (si);
+ if (!is_gimple_call (stmt))
+ continue;
+
+ check (as_a <gcall *>(stmt));
if (gcall *call = dyn_cast <gcall *> (gsi_stmt (si)))
check (call);
might be more C++-ish.
The patch looks OK - I skimmed it as mostly moving things
around plus adding a new pass.
Thanks,
Richard.
> Martin
>
> PS The builtins.c diff produced by git diff was much bigger than
> the changes justify. It seems that the code removal somehow
> confused it. To make review easy I replaced it with a plain
> unified diff of builtins.c that doesn't suffer from the problem.
next prev parent reply other threads:[~2021-07-28 9:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 22:39 Martin Sebor
2021-07-23 16:48 ` PING " Martin Sebor
2021-07-28 9:23 ` Richard Biener [this message]
2021-07-28 22:09 ` Martin Sebor
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=CAFiYyc2oVOAEmADy3kCEh0WLVaO1vMWoXDJPUs7dOQo9VrVPtw@mail.gmail.com \
--to=richard.guenther@gmail.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).