From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A97A3850432; Tue, 17 Aug 2021 20:53:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A97A3850432 From: "msebor at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: short_desc cf_known_to_fail Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 20:53:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101854 Martin Sebor 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 --- Fixed for GCC 12. The patch is far too intrusive to backport but the follo= wing 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 =3D rdwr_idx.get (argpos)) { + int idx =3D i - !!struct_value_addr_value; if (POINTER_TYPE_P (type)) { - access->ptr =3D args[i].tree_value; + access->ptr =3D args[idx].tree_value; // A nonnull ACCESS->SIZE contains VLA bounds. */ } else { - access->size =3D args[i].tree_value; + access->size =3D args[idx].tree_value; gcc_assert (access->ptr =3D=3D NULL_TREE); } }=