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

            Bug ID: 117856
           Summary: ICE: tree check: expected class ‘type’, have
                    ‘exceptional’ (error_mark) in gen_type, at
                    c/c-aux-info.cc:279 with the specified options
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

*******************************************************************************
The compiler produces an internal error during gen_type when compiling the
provided code with the specified options: -fstack-protector-explicit -aux-info
-fhosted -freciprocal-math -fsched-spec-load -fsched-group-heuristic
-fschedule-insns2 .
The issue can also be reproduced on Compiler Explorer.

*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-241127/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241127
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241127 (experimental) (GCC) 
*******************************************************************************
Program:
#cat new.c
static int b (enum a mode) {}
static void c (void) { b (2); }

*******************************************************************************
Command Lines:
gcc new.c -fstack-protector-explicit -aux-info -fhosted -freciprocal-math
-fsched-spec-load -fsched-group-heuristic -fschedule-insns2 -c -o new.o


new.c:1:22: error: parameter 1 (‘mode’) has incomplete type
    1 | static int b (enum a mode) {}
      |               ~~~~~~~^~~~
new.c: In function ‘b’:
new.c:1:20: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in gen_type, at c/c-aux-info.cc:279
    1 | static int b (enum a mode) {}
      |                    ^
0x2666b9e internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:518
0x8f5674 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/gcc/tree.cc:9070
0x7b0ff1 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc/gcc/tree.h:3798
0x7b0ff1 gen_type
        ../../gcc/gcc/c/c-aux-info.cc:279
0xa63308 gen_decl
        ../../gcc/gcc/c/c-aux-info.cc:520
0xa63545 gen_formal_list_for_func_def
        ../../gcc/gcc/c/c-aux-info.cc:213
0xa63452 gen_decl
        ../../gcc/gcc/c/c-aux-info.cc:507
0xa636ba gen_aux_info_record(tree_node*, int, int, int)
        ../../gcc/gcc/c/c-aux-info.cc:562
0xa294a7 store_parm_decls()
        ../../gcc/gcc/c/c-decl.cc:11310
0xa9d420 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.cc:3027
0xaa8aad c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.cc:2065
0xaa954d c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.cc:1919
0xaa954d c_parse_file()
        ../../gcc/gcc/c/c-parser.cc:28017
0xb28101 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1375
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

*******************************************************************************

Also ICE on trunk, compiler explorer:https://godbolt.org/z/c8Tq67jse

*******************************************************************************

Reply via email to