https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124522
Bug ID: 124522
Summary: Segmentation fault in finish_member_declaration on
invalid member declaration with nested
enum/struct/union
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: suyuchang at whu dot edu.cn
Target Milestone: ---
Code:
struct a { enum a ::a : struct {} union {}
Command:
g++ test.cpp
test.cpp:1:42: internal compiler error: Segmentation fault
1 | struct a { enum a ::a : struct {} union {}
| ^
0x2cb8d8e internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x16f2b26 crash_signal
../../gcc-trunk/gcc/toplev.cc:325
0x7fbbf6b5251f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xf2b16c tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-trunk/gcc/tree.h:3934
0xf2b16c finish_member_declaration(tree_node*)
../../gcc-trunk/gcc/cp/semantics.cc:4269
0xe74130 cp_parser_member_declaration
../../gcc-trunk/gcc/cp/parser.cc:31118
0xe38c95 cp_parser_member_specification_opt
../../gcc-trunk/gcc/cp/parser.cc:30794
0xe38c95 cp_parser_class_specifier
../../gcc-trunk/gcc/cp/parser.cc:29711
0xe3a38f cp_parser_type_specifier
../../gcc-trunk/gcc/cp/parser.cc:22337
0xe5b700 cp_parser_decl_specifier_seq
../../gcc-trunk/gcc/cp/parser.cc:18843
0xe70847 cp_parser_simple_declaration
../../gcc-trunk/gcc/cp/parser.cc:17943
0xe7febb cp_parser_declaration
../../gcc-trunk/gcc/cp/parser.cc:17601
0xe83628 cp_parser_toplevel_declaration
../../gcc-trunk/gcc/cp/parser.cc:17705
0xe83628 cp_parser_translation_unit
../../gcc-trunk/gcc/cp/parser.cc:5596
0xe83628 c_parse_file()
../../gcc-trunk/gcc/cp/parser.cc:57467
0x1025990 c_common_parse_file()
../../gcc-trunk/gcc/c-family/c-opts.cc:1422
/home/syc/gcc-16.0/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -quiet
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -quiet -dumpdir a-
-dumpbase test.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -o
/tmp/ccCwHk7v.s
Goes back to a while: https://godbolt.org/z/rPboK931c
The test case was generated by a fuzzer.