From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BB6ED394EC31; Mon, 8 Mar 2021 17:34:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB6ED394EC31 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/99420] New warning -Warray-parameter Date: Mon, 08 Mar 2021 17:34:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.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: --- 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 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: Mon, 08 Mar 2021 17:34:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99420 --- Comment #3 from Martin Sebor --- The false positive is caused by the local redeclaration of f1() in h() below not having had the type attributes added to it describing the form of the array. This happens because instead of merging the type attributes from the previous declaration of f1() in g() into those in h() as is done for f0, pushdecl() sets them to null (on lines 3525-3562 in c/c-decl.c). The difference is due to pushdecl() treating redeclarations of entities that ar= e in scope (like f0) differently than those that aren't (like f1() in h()). $ cat u.c && gcc -S -Wall u.c void f0 (int [1]); void f0 (int [1]); // okay void g (void) { void f1 (int [1]); } void h (void) { void f1 (int [1]); // bogus -Warray-parameter } u.c: In function =E2=80=98h=E2=80=99: u.c:11:12: warning: argument 1 of type =E2=80=98int[1]=E2=80=99 with mismat= ched bound [-Warray-parameter=3D] 11 | void f1 (int [1]); // bogus -Warray-parameter | ^~~~~~~ u.c:6:12: note: previously declared as =E2=80=98int *=E2=80=99 6 | void f1 (int [1]); | ^~~~~~~=