The following is obviously not a valid C++ program but crashes the compiler: a(){[](class{ Output: <source>:1:3: error: ISO C++ forbids declaration of 'a' with no type [-fpermissive] a(){[](class{ ^ <source>: In function 'int a()': <source>:1:13: error: types may not be defined in parameter types a(){[](class{ ^ <source>:1:13: error: expected '}' at end of input <source>:1:13: error: expected ',' or '...' at end of input <source>:1:13: error: expected ')' at end of input g++: internal compiler error: Segmentation fault (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 4 I used C-Reduce on a bigger program to find a smaller test case.
Confirmed.
Started to ICE in between r152207 and r152360, seems endless recursion in dump_* while trying to print some diagnostics.
BTW, when using creduce, if the original is valid or has just one error or something similar, please try to write the script such that it will not confirm a reduction which has also other errors, otherwise you end up with testcases like this which have just too many errors in it.
(In reply to Jakub Jelinek from comment #3) > BTW, when using creduce, if the original is valid or has just one error or > something similar, please try to write the script such that it will not > confirm a reduction which has also other errors, otherwise you end up with > testcases like this which have just too many errors in it. Thanks, I will try to do this in the future. I believe the original had only one error.
I have another testcase which crashes in a similar way, but I'm not sure if it's the same underlying bug or not: void a() { enum * { [] (union {}) }; } The original crash was: (gdb) run Starting program: xgcc -x c++ -std=c++14 -O3 -Wall -fpermissive -c input-1.cc [New process 19395] process 19395 is executing new program: cc1plus input-1.cc:1:3: warning: ISO C++ forbids declaration of 'a' with no type [-fpermissive] a(){[](class{ ^ input-1.cc: In function 'int a()': input-1.cc:1:13: error: types may not be defined in parameter types a(){[](class{ ^ input-1.cc:1:13: error: expected '}' at end of input input-1.cc:1:13: error: expected ',' or '...' at end of input input-1.cc:1:14: error: expected ')' at end of input a(){[](class{ ~ ~^ ) Thread 2.1 "cc1plus" received signal SIGSEGV, Segmentation fault. [Switching to process 19395] 0x000000000167a1f4 in ggc_internal_alloc (size=48, f=0x0, s=0, n=1) at /home/vegard/git/gcc/gcc/ggc-page.c:1274 1274 entry = G.pages[order]; (gdb) bt #0 0x000000000167a1f4 in ggc_internal_alloc (size=48, f=0x0, s=0, n=1) at /home/vegard/git/gcc/gcc/ggc-page.c:1274 #1 0x0000000000000000 in ?? () The new one is: (gdb) run Starting program: xgcc -x c++ -std=c++14 -O3 -Wall -fpermissive -c input.cc [New process 14133] process 14133 is executing new program: cc1plus input.cc: In function 'void a()': input.cc:3:15: error: types may not be defined in parameter types [] (union {}) ^ Thread 2.1 "cc1plus" received signal SIGSEGV, Segmentation fault. [Switching to process 14133] 0x00000000010529cd in dguide_name_p (name=0x7ffff6d5c000) at /home/vegard/git/gcc/gcc/cp/pt.c:25423 25423 { (gdb) bt #0 0x00000000010529cd in dguide_name_p (name=0x7ffff6d5c000) at /home/vegard/git/gcc/gcc/cp/pt.c:25423 #1 0x0000000000000000 in ?? () It crashes in a different place but they both have the "types may not be defined in parameter types" error and I'm not sure why gdb is not able to follow the stack properly.
GCC 6 branch is being closed
The GCC 7 branch is being closed, re-targeting to GCC 8.4.
GCC 8.4.0 has been released, adjusting target milestone.
GCC 8 branch is being closed.
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
GCC 9 branch is being closed
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
GCC 10 branch is being closed.
Dup of bug 56260. *** This bug has been marked as a duplicate of bug 56260 ***