public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/101854] [11 Regression] Invalid warning -Wstringop-overflow wrong argument
Date: Tue, 17 Aug 2021 20:53:20 +0000	[thread overview]
Message-ID: <bug-101854-4-TPhQLbGStW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101854-4@http.gcc.gnu.org/bugzilla/>

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] Invalid  |[11 Regression] Invalid
                   |warning -Wstringop-overflow |warning -Wstringop-overflow
                   |wrong argument              |wrong argument
      Known to fail|                            |11.2.0

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed for GCC 12.  The patch is far too intrusive to backport but the following
should fix the problem in GCC 11:

diff --git a/gcc/calls.c b/gcc/calls.c
index fcb0d6dec69..f116923c890 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2295,14 +2295,15 @@ initialize_argument_information (int num_actuals
ATTRIBUTE_UNUSED,
         operand for later processing.  */
       if (attr_access *access = rdwr_idx.get (argpos))
        {
+         int idx = i - !!struct_value_addr_value;
          if (POINTER_TYPE_P (type))
            {
-             access->ptr = args[i].tree_value;
+             access->ptr = args[idx].tree_value;
              // A nonnull ACCESS->SIZE contains VLA bounds.  */
            }
          else
            {
-             access->size = args[i].tree_value;
+             access->size = args[idx].tree_value;
              gcc_assert (access->ptr == NULL_TREE);
            }
        }

  parent reply	other threads:[~2021-08-17 20:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10 23:39 [Bug c/101854] New: " nightstrike at gmail dot com
2021-08-10 23:44 ` [Bug tree-optimization/101854] " pinskia at gcc dot gnu.org
2021-08-10 23:45 ` [Bug c/101854] " nightstrike at gmail dot com
2021-08-10 23:48 ` [Bug tree-optimization/101854] " pinskia at gcc dot gnu.org
2021-08-10 23:50 ` nightstrike at gmail dot com
2021-08-10 23:51 ` pinskia at gcc dot gnu.org
2021-08-10 23:56 ` [Bug tree-optimization/101854] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-08-10 23:58 ` pinskia at gcc dot gnu.org
2021-08-12 22:30 ` msebor at gcc dot gnu.org
2021-08-12 22:30 ` msebor at gcc dot gnu.org
2021-08-17 20:51 ` cvs-commit at gcc dot gnu.org
2021-08-17 20:53 ` msebor at gcc dot gnu.org [this message]
2022-04-21  7:50 ` [Bug tree-optimization/101854] [11 " rguenth at gcc dot gnu.org
2022-12-22  2:49 ` nightstrike at gmail dot com
2023-05-29 10:05 ` jakub at gcc dot gnu.org

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-101854-4-TPhQLbGStW@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).