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

            Bug ID: 113969
           Summary: ICE: SIGSEGV in finish_enum_value_list (decl.cc:17143)
                    on invalid code
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 57447
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57447&action=edit
auto-reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.C -wrapper valgrind,-q
testcase.C:2:40: error: expected '}' before 'd'
    2 | template <typename = enum struct b { c d } template <> enum struct b {
      |                                    ~   ^
testcase.C:2:40: error: expected '>' before 'd'
testcase.C:2:42: error: expected unqualified-id before '}' token
    2 | template <typename = enum struct b { c d } template <> enum struct b {
      |                                          ^
testcase.C:2:42: error: expected declaration before '}' token
testcase.C:2:71: error: expected identifier at end of input
    2 | template <typename = enum struct b { c d } template <> enum struct b {
      |                                                                       ^
testcase.C:2:71: error: expected '}' at end of input
    2 | template <typename = enum struct b { c d } template <> enum struct b {
      |                                                                      ~^
==8124== Invalid read of size 2
==8124==    at 0xF95EFF: finish_enum_value_list(tree_node*) (decl.cc:17143)
==8124==    by 0x1092B26: cp_parser_enum_specifier(cp_parser*)
(parser.cc:21792)
==8124==    by 0x10772CE: cp_parser_type_specifier(cp_parser*, int,
cp_decl_specifier_seq*, bool, int*, bool*) (parser.cc:20034)
==8124==    by 0x1078E2D: cp_parser_decl_specifier_seq(cp_parser*, int,
cp_decl_specifier_seq*, int*) (parser.cc:16590)
==8124==    by 0x10AE38A: cp_parser_single_declaration(cp_parser*,
vec<deferred_access_check, va_gc, vl_embed>*, bool, bool, bool*)
(parser.cc:33137)
==8124==    by 0x10AFA00: cp_parser_explicit_specialization(cp_parser*)
(parser.cc:19945)
==8124==    by 0x10B3EC5: cp_parser_declaration(cp_parser*, tree_node*)
(parser.cc:15499)
==8124==    by 0x10B461A: cp_parser_toplevel_declaration (parser.cc:15594)
==8124==    by 0x10B461A: cp_parser_translation_unit (parser.cc:5279)
==8124==    by 0x10B461A: c_parse_file() (parser.cc:51202)
==8124==    by 0x1203D81: c_common_parse_file() (c-opts.cc:1311)
==8124==    by 0x18172DD: compile_file() (toplev.cc:447)
==8124==    by 0xEC6EDB: do_compile (toplev.cc:2152)
==8124==    by 0xEC6EDB: toplev::main(int, char**) (toplev.cc:2308)
==8124==    by 0xEC86ED: main (main.cc:39)
==8124==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==8124== 
testcase.C:2:71: internal compiler error: Segmentation fault
^C

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-9043-20240217001708-gd70f155b074-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-9043-20240217001708-gd70f155b074-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240217 (experimental) (GCC)

Reply via email to