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

            Bug ID: 124500
           Summary: Segmentation fault on invalid template default
                    argument with enum and sizeof...
           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:
template <typename = enum { a, a = sizeof... a

Command:
g++ test.cpp

Output:
test.cpp:1:46: internal compiler error: Segmentation fault
0x2cb8d8e internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x16f2b26 crash_signal
        ../../gcc-trunk/gcc/toplev.cc:325
0x7f927307951f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xe3d3f4 tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
        ../../gcc-trunk/gcc/tree.h:3798
0xe3d3f4 cp_parser_sizeof_pack
        ../../gcc-trunk/gcc/cp/parser.cc:37222
0xe3d3f4 cp_parser_sizeof_operand
        ../../gcc-trunk/gcc/cp/parser.cc:37248
0xe3b9ee cp_parser_unary_expression
        ../../gcc-trunk/gcc/cp/parser.cc:10274
0xe1cac8 cp_parser_cast_expression
        ../../gcc-trunk/gcc/cp/parser.cc:11540
0xe1dc9e cp_parser_binary_expression
        ../../gcc-trunk/gcc/cp/parser.cc:11643
0xe1ef71 cp_parser_assignment_expression
        ../../gcc-trunk/gcc/cp/parser.cc:11996
0xe27304 cp_parser_constant_expression
        ../../gcc-trunk/gcc/cp/parser.cc:12316
0xe4a700 cp_parser_enumerator_definition
        ../../gcc-trunk/gcc/cp/parser.cc:24186
0xe4a700 cp_parser_enumerator_list
        ../../gcc-trunk/gcc/cp/parser.cc:24126
0xe4a700 cp_parser_enum_specifier
        ../../gcc-trunk/gcc/cp/parser.cc:24057
0xe3a423 cp_parser_type_specifier
        ../../gcc-trunk/gcc/cp/parser.cc:22307
0xe3a768 cp_parser_type_specifier_seq
        ../../gcc-trunk/gcc/cp/parser.cc:27993
0xe4813e cp_parser_type_id_1
        ../../gcc-trunk/gcc/cp/parser.cc:27756
0xe4da85 cp_parser_type_id
        ../../gcc-trunk/gcc/cp/parser.cc:27864
0xe4da85 cp_parser_default_type_template_argument
        ../../gcc-trunk/gcc/cp/parser.cc:20698
0xe6c4cb cp_parser_type_parameter
        ../../gcc-trunk/gcc/cp/parser.cc:20936
/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/ccq1ggTy.s

Goes back to a while: https://godbolt.org/z/axofjbdMb

The test case was generated by a fuzzer.

Reply via email to