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

            Bug ID: 96442
           Summary: ICE in tree check: expected integer_type or
                    enumeral_type or boolean_type or real_type or
                    fixed_point_type, have record_type in int_fits_type_p,
                    at tree.c:8954
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, all.

This code, reduced by C-Vise, makes GCC-trunk ICE and makes released GCC
versions "confused by early errors".

Input:
//small.cc
enum struct a : struct {};
template <class b> enum class a : class c{};
enum struct a {b};

Command:
g++ small.cc

Output:
small.cc:1:25: error: underlying type ‘<unnamed struct>’ of ‘a’ must be an
integral type
    1 | enum struct a : struct {};
      |                         ^
small.cc:3:13: error: different underlying type in enum ‘enum class a’
    3 | enum struct a {b};
      |             ^
small.cc:1:25: note: previous definition here
    1 | enum struct a : struct {};
      |                         ^
small.cc:3:16: internal compiler error: tree check: expected integer_type or
enumeral_type or boolean_type or real_type or fixed_point_type, have
record_type in int_fits_type_p, at tree.c:8954
    3 | enum struct a {b};
      |                ^
0x7c7fd7 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9687
0x7ceec0 tree_check5(tree_node const*, char const*, int, char const*,
tree_code, tree_code, tree_code, tree_code, tree_code)
        ../../gcc/tree.h:3650
0x7ceec0 int_fits_type_p(tree_node const*, tree_node const*)
        ../../gcc/tree.c:8954
0x919b9a build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*,
unsigned int)
        ../../gcc/cp/decl.c:15906
0x9aafec cp_parser_enumerator_definition
        ../../gcc/cp/parser.c:19585
0x9aafec cp_parser_enumerator_list
        ../../gcc/cp/parser.c:19514
0x9aafec cp_parser_enum_specifier
        ../../gcc/cp/parser.c:19444
0x9aafec cp_parser_type_specifier
        ../../gcc/cp/parser.c:17769
0x9ab50e cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:14436
0x9ac2c1 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13690
0x9d763e cp_parser_declaration
        ../../gcc/cp/parser.c:13510
0x9d7d2b cp_parser_translation_unit
        ../../gcc/cp/parser.c:4793
0x9d7d2b c_parse_file()
        ../../gcc/cp/parser.c:44081
0xaf2e9d c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1188
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

My gcc version is
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/haoxin/corpus-compilers/gcc-trunk/gcc-master/build/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/home/haoxin/corpus-compilers/gcc-trunk/gcc-master/build/
--enable-languages=c,c++ CC=gcc CXX=g++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200801 (experimental) (GCC) 

Thanks,
Haoxin

Reply via email to