public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: PING [PATCH] add access warning pass
Date: Fri, 23 Jul 2021 10:48:34 -0600	[thread overview]
Message-ID: <af5114ab-6ee5-4e6e-0654-ea5ec4d01878@gmail.com> (raw)
In-Reply-To: <bfd140bd-66e3-0642-992b-1d975265fdb1@gmail.com>

Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575377.html

On 7/15/21 4:39 PM, Martin Sebor 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.
> 
> 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.


  reply	other threads:[~2021-07-23 16:48 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 ` Martin Sebor [this message]
2021-07-28  9:23 ` Richard Biener
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=af5114ab-6ee5-4e6e-0654-ea5ec4d01878@gmail.com \
    --to=msebor@gmail.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).