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

            Bug ID: 120899
           Summary: Duplicate diagnostics about jump into scope of
                    pointer-to-VLA variable
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stephenheumann at gmail dot com
  Target Milestone: ---

Compiling this:

```
int main(int argc, char *argv[]) {
        goto lab;
        int (*a)[argc];
lab:    ;
}
```

gives the following diagnostics:

test.c: In function 'main':
test.c:2:9: error: jump into scope of identifier with variably modified type
    2 |         goto lab;
      |         ^~~~
test.c:4:1: note: label 'lab' defined here
    4 | lab:    ;
      | ^~~
test.c:3:15: note: 'a' declared here
    3 |         int (*a)[argc];
      |               ^
test.c:2:9: error: jump into scope of identifier with variably modified type
    2 |         goto lab;
      |         ^~~~
test.c:4:1: note: label 'lab' defined here
    4 | lab:    ;
      | ^~~
test.c:3:15: note: '({anonymous})' declared here
    3 |         int (*a)[argc];
      |               ^

The second set of error/note/note are duplicates of the first, except that they
refer to '({anonymous})' instead of an actual identifier.

Godbolt link: https://godbolt.org/z/3sxoGMrEf

>From checking different versions on Godbolt, the duplicate diagnostics have
been present since GCC 4.5.3, but not in GCC 4.4.7.

Reply via email to