https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120246
Bug ID: 120246 Summary: ICE: tree check: expected class type, have exceptional (error_mark) in fold_const_call_1, at fold-const-call.cc:1569 Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rundongyang22 at m dot fudan.edu.cn Target Milestone: --- Created attachment 61410 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61410&action=edit The preprocessed source(with -save-temp) # gcc Version & System Type & Configure Option $ $CC -v Using built-in specs. COLLECT_GCC=/home/liuyu/Desktop/gcc-13/bin/gcc COLLECT_LTO_WRAPPER=/home/liuyu/Desktop/gcc-13/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.1.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --enable-languages=c,c++ --prefix=/home/liuyu/Desktop/bin Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.1.0 (GCC) # Compiler Output $CC -save-temps 2042.c 2042.c:11:1: warning: ‘const’ attribute on function returning ‘void’ [-Wattributes] 11 | __attribute__((const)) void print_args(const char *format, ...) { | ^~~~~~~~~~~~~ 2042.c: In function ‘print_args’: 2042.c:30:28: error: conflicting types for ‘num’; have ‘double’ 30 | double num = va_arg(args, double); | ^~~ 2042.c:25:25: note: previous definition of ‘num’ with type ‘int’ 25 | int num = va_arg(args, int); | ^~~ 2042.c:26:21: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in fold_const_call_1, at fold-const-call.cc:1569 26 | printf("%d", num); | ^~~~~~~~~~~~~~~~~ 0x19dcb2a tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/tree.cc:8931 0xc3ae27 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc/tree.h:3663 0x10da774 fold_const_call_1 ../../gcc/fold-const-call.cc:1569 0x10db6f2 fold_const_call(combined_fn, tree_node*, tree_node*, tree_node*) ../../gcc/fold-const-call.cc:1745 0xe55af6 fold_builtin_2 ../../gcc/builtins.cc:9785 0xe5616f fold_builtin_n ../../gcc/builtins.cc:9949 0xe56813 fold_call_expr(unsigned int, tree_node*, bool) ../../gcc/builtins.cc:10047 0x1182954 gimplify_call_expr ../../gcc/gimplify.cc:3684 0x11bc932 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16348 0x118fbbc gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7219 0x117d35e gimplify_statement_list ../../gcc/gimplify.cc:2019 0x11be993 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16821 0x118fbbc gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7219 0x117b13a gimplify_bind_expr ../../gcc/gimplify.cc:1430 0x11bd7ec gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16577 0x118fbbc gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7219 0x117d35e gimplify_statement_list ../../gcc/gimplify.cc:2019 0x11be993 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16821 0x118fbbc gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7219 0x117f0c2 gimplify_switch_expr ../../gcc/gimplify.cc:2716 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.