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

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
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 are 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 ‘h’:
u.c:11:12: warning: argument 1 of type ‘int[1]’ with mismatched bound
[-Warray-parameter=]
   11 |   void f1 (int [1]);   // bogus -Warray-parameter
      |            ^~~~~~~
u.c:6:12: note: previously declared as ‘int *’
    6 |   void f1 (int [1]);
      |            ^~~~~~~

Reply via email to