From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BE7E3858284; Thu, 22 Dec 2022 02:49:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BE7E3858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671677371; bh=rReDGM/rV/3jTrpP9DnRmSxj0VcovzLNhkp2iR/ft+E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BqVwVWQ37EExnHIE3hmuH4vb8STeu5JkB81llAGUo9L3MSL3wpGrA6L1mrDbaX6fE Gvikj2UrJKLNde639eqoy+2zQ8lCsrCkO1w00wr+USMoAZ828etvwMjzQBYL8yqeKW EsRVtWaDgtngMtiHX81FLLinkUGqC0BKmxQOnVfU= From: "nightstrike at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101854] [11 Regression] Invalid warning -Wstringop-overflow wrong argument Date: Thu, 22 Dec 2022 02:49:30 +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: nightstrike at gmail dot com 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.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101854 --- Comment #11 from nightstrike --- (In reply to Martin Sebor from comment #9) > Fixed for GCC 12. The patch is far too intrusive to backport but the > following should fix the problem in GCC 11: Would you mind applying it to 11? Thanks! Also, I think in your diff below, there's "// A nonnull" that should be "/*= A nonnull"... / to * > 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); > } > }=