https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100719
Bug ID: 100719
Summary: missing -Wvla-parameter on a mismatch in second
parameter
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
-Wvla-parameter diagnoses the mismatch in the second argument in the
redeclaration of f() but misses the same mismatch in the third argument in g().
$ cat a.c && gcc -S -Wall a.c
void f (int n, int[n]);
void f (int n, int[n + 1]); // -Wvla-parameter (good)
void g (int n, int[n], char[n]);
void g (int n, int[n], char[n + 1]); // missing -Wvla-parameter
a.c:2:16: warning: argument 2 of type ‘int[n + 1]’ declared with mismatched
bound ‘n + 1’ [-Wvla-parameter]
2 | void f (int n, int[n + 1]); // -Wvla-parameter (good)
| ^~~~~~~~~~
a.c:1:16: note: previously declared as ‘int[n]’ with bound argument 1
1 | void f (int n, int[n]);
| ~~~~~ ^~~~~~