https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124523
Bug ID: 124523
Summary: Segmentation fault on invalid enum declaration after
namespace alias and class declaration
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:
namespace a {
namespace {
namespace a = a
}
class a enum struct a ::a;
Command:
g++ test.cpp
test.cpp:5:25: internal compiler error: Segmentation fault
5 | class a enum struct a ::a;
| ^
0x2cb8d8e internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x16f2b26 crash_signal
../../gcc-trunk/gcc/toplev.cc:325
0x7f5a7a8c151f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xde32b3 resume_scope
../../gcc-trunk/gcc/cp/name-lookup.cc:4926
0xdfb4ad push_nested_namespace(tree_node*)
../../gcc-trunk/gcc/cp/name-lookup.cc:9048
0xe4a524 cp_parser_enum_specifier
../../gcc-trunk/gcc/cp/parser.cc:23939
0xe3a423 cp_parser_type_specifier
../../gcc-trunk/gcc/cp/parser.cc:22307
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
0xe7f761 cp_parser_toplevel_declaration
../../gcc-trunk/gcc/cp/parser.cc:17705
0xe7f761 cp_parser_declaration_seq_opt
../../gcc-trunk/gcc/cp/parser.cc:17410
0xe7fc13 cp_parser_namespace_body
../../gcc-trunk/gcc/cp/parser.cc:24431
0xe7fc13 cp_parser_namespace_definition
../../gcc-trunk/gcc/cp/parser.cc:24409
0xe80889 cp_parser_declaration
../../gcc-trunk/gcc/cp/parser.cc:17664
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/ccry8hps.s
Goes back to a while: https://godbolt.org/z/WbP97Geh9
The test case was generated by a fuzzer.