From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2402385501B; Thu, 12 Aug 2021 22:30:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2402385501B From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101854] [11/12 Regression] Invalid warning -Wstringop-overflow wrong argument Date: Thu, 12 Aug 2021 22:30:05 +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: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc cf_reconfirmed_on blocked bug_status everconfirmed 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: Thu, 12 Aug 2021 22:30:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101854 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Last reconfirmed| |2021-08-12 Blocks| |88443 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #7 from Martin Sebor --- Below is a further simplified test case. The code in initialize_argument_information() that computes the sizes of actual argumen= ts to array parameters and issues a warning if the former is less than expected doesn't consider the implicit pointer argument passed to functions that ret= urn structs by value. It's off by one for those. $ cat t.c && gcc -S -Wall t.c struct A { int a[5]; }; struct A g (int*, int[6][8]); struct A f (void) { int a[2]; return g (a, 0); } t.c: In function =E2=80=98f=E2=80=99: t.c:8:10: warning: =E2=80=98g=E2=80=99 accessing 192 bytes in a region of s= ize 8 [-Wstringop-overflow=3D] 8 | return g (a, 0); | ^~~~~~~~ t.c:8:10: note: referencing argument 2 of type =E2=80=98int (*)[8]=E2=80=99 t.c:3:10: note: in a call to function =E2=80=98g=E2=80=99 3 | struct A g (int*, int[6][8]); | ^ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88443 [Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings=