public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/94629] 10 issues located by the PVS-studio static analyzer
Date: Fri, 17 Apr 2020 10:31:25 +0000	[thread overview]
Message-ID: <bug-94629-4-IG0nmV7dgh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94629-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94629

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Comment on attachment 48299
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48299
sorted list of redundant assignments

  /* If there were any declarations or structure tags in that level,
     or if this level is a function body,
     create a BLOCK to record them for the life of this function.  */
  block = NULL_TREE;
  /* Avoid function body block if possible.  */
  if (functionbody && subblocks && BLOCK_CHAIN (subblocks) == NULL_TREE)
    keep = 0;
  else if (keep == 1 || functionbody)
    block = make_node (BLOCK);
  if (block != NULL_TREE)
    {
      BLOCK_VARS (block) = decls;
      BLOCK_SUBBLOCKS (block) = subblocks;
    }

  /* In each subblock, record that this is its superior.  */
  if (keep >= 0)
    for (link = subblocks; link; link = BLOCK_CHAIN (link))
      BLOCK_SUPERCONTEXT (link) = block;
certainly doesn't look like redundant assignment, yes, the block = NULL_TREE
could be moved into the if, but that is just programming style.
I must say I don't understand why the separate if (block != NULL_TREE) is in
there, perhaps from historic reasons there might have been more cases.
Now it would make much more sense to just do
  else if (keep == 1 || functionbody)
    {
      block = make_node (BLOCK);
      BLOCK_VARS (block) = decls;
      BLOCK_SUBBLOCKS (block) = subblocks;
    }

  parent reply	other threads:[~2020-04-17 10:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 22:58 [Bug other/94629] New: " leo at yuriev dot ru
2020-04-17  6:32 ` [Bug other/94629] " marxin at gcc dot gnu.org
2020-04-17  7:13 ` rguenth at gcc dot gnu.org
2020-04-17  7:22 ` rguenth at gcc dot gnu.org
2020-04-17  7:25 ` rguenth at gcc dot gnu.org
2020-04-17  8:39 ` cvs-commit at gcc dot gnu.org
2020-04-17  9:14 ` jakub at gcc dot gnu.org
2020-04-17 10:09 ` dcb314 at hotmail dot com
2020-04-17 10:13 ` jakub at gcc dot gnu.org
2020-04-17 10:18 ` dcb314 at hotmail dot com
2020-04-17 10:31 ` jakub at gcc dot gnu.org [this message]
2020-04-17 11:00 ` jakub at gcc dot gnu.org
2020-04-17 12:08 ` ams at gcc dot gnu.org
2020-04-17 12:13 ` jakub at gcc dot gnu.org
2020-04-17 15:02 ` cvs-commit at gcc dot gnu.org
2020-04-17 15:10 ` dcb314 at hotmail dot com
2020-04-17 22:13 ` msebor at gcc dot gnu.org
2020-04-19 20:06 ` cvs-commit at gcc dot gnu.org
2020-04-19 20:07 ` redi at gcc dot gnu.org
2020-04-20  9:56 ` marxin at gcc dot gnu.org
2020-04-20 13:22 ` leo at yuriev dot ru
2020-04-20 19:31 ` tschwinge at gcc dot gnu.org
2020-04-21 13:17 ` cvs-commit at gcc dot gnu.org
2020-04-23 14:05 ` cvs-commit at gcc dot gnu.org
2020-04-23 14:13 ` ams at gcc dot gnu.org
2020-05-08 20:09 ` leo at yuriev dot ru
2020-05-11  7:19 ` marxin at gcc dot gnu.org
2024-01-17 21:19 ` jamborm at gcc dot gnu.org
2024-01-20 17:16 ` pinskia at gcc dot gnu.org
2024-01-20 20:27 ` dcb314 at hotmail dot com
2024-01-20 20:45 ` jamborm at gcc dot gnu.org
2024-01-21  8:12 ` dcb314 at hotmail dot com

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=bug-94629-4-IG0nmV7dgh@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).