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

            Bug ID: 98091
           Summary: unspecified VLA bound formatted as [0] instead of [*]
                    in -Wvla-parameter
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The mismatched VLA bound in the argument in the second warning should be
formatted the same way as in the first warning, i.e., as 'int[n][*]', and not
as 'int[n][0]'

The test case has been extracted from gcc/testsuite/gcc.dg/Wvla-parameter-2.c.

$ cat a.c && gcc -S -Wall a.c
int n;

void f (int[n][n]);
void f (int[*][n]);

void g (int[n][n]);
void g (int[n][*]);
a.c:4:9: warning: argument 1 of type ‘int[*][n]’ declared with 1 unspecified
variable bound [-Wvla-parameter]
    4 | void f (int[*][n]);
      |         ^~~~~~~~~
a.c:3:9: note: previously declared as ‘int[n][n]’ with 0 unspecified variable
bounds
    3 | void f (int[n][n]);
      |         ^~~~~~~~~
a.c:7:9: warning: argument 1 of type ‘int[n][0]’ declared with 1 unspecified
variable bound [-Wvla-parameter]
    7 | void g (int[n][*]);
      |         ^~~~~~~~~
a.c:6:9: note: previously declared as ‘int[n][n]’ with 0 unspecified variable
bounds
    6 | void g (int[n][n]);
      |         ^~~~~~~~~

Reply via email to