https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21113
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Last reconfirmed|2012-01-05 00:00:00 |2016-3-7 CC| |msebor at gcc dot gnu.org Known to work| |4.9.3, 5.3.0, 6.0 Resolution|--- |FIXED Known to fail| |4.1.2, 4.5.3 --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- Fixed in r209124 a couple of years ago. Today's trunk rejects the test case with the following output. $ cat x.c && /build/gcc-trunk-bootstrap/gcc/xg++ -B /build/gcc-trunk-bootstrap/gcc -S -Wall -Wextra -Wpedantic -o/dev/null -xc++ x.c void f(int l) { goto label; int a[l]; label:; } void g (int l) { switch (l) { case 1:; int a[l]; default:; } } x.c: In function ‘void f(int)’: x.c:3:10: warning: ISO C++ forbids variable length array ‘a’ [-Wvla] int a[l]; ^ x.c:4:2: error: jump to label ‘label’ [-fpermissive] label:; ^~~~~ x.c:2:8: note: from here goto label; ^~~~~ x.c:3:10: note: crosses initialization of ‘sizetype <anonymous>’ int a[l]; ^ x.c:3:7: note: crosses initialization of ‘int a [l]’ int a[l]; ^ x.c:3:7: warning: unused variable ‘a’ [-Wunused-variable] x.c: In function ‘void g(int)’: x.c:10:12: warning: ISO C++ forbids variable length array ‘a’ [-Wvla] int a[l]; ^ x.c:11:3: error: jump to case label [-fpermissive] default:; ^~~~~~~ x.c:10:12: note: crosses initialization of ‘sizetype <anonymous>’ int a[l]; ^ x.c:10:9: note: crosses initialization of ‘int a [l]’ int a[l]; ^ x.c:10:9: warning: unused variable ‘a’ [-Wunused-variable]