https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98539
Bug ID: 98539
Summary: incorrect warning with -Wvla-parameter for unspecified
bound in multi-dim array
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: muecker at gwdg dot de
Target Milestone: ---
For the following example:
void foo(int n, double x[3][*]);
void foo(int n, double x[3][n]) { }
I get the warning:
x.c:5:24: warning: argument 2 of type ‘double[3][n]’ declared as a variable
length array [-Wvla-parameter]
5 | void foo(int n, double x[3][n])
| ~~~~~~~^~~~~~~
x.c:3:24: note: previously declared as an ordinary array ‘double[3][0]’
3 | void foo(int n, double x[3][*]);
| ~~~~~~~^~~~~~~
This is incorrect, as the unspecified bound implies a variable length array and
not an ordinary array (6.7.6.2p4).
There is no warning for:
void foo(int n, double x[3][*]);
void foo(int n, double x[3][4]);