https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101364
Bug ID: 101364 Summary: [12 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: anbu1024.me at gmail dot com Target Milestone: --- $ cat test.c void fruit(); struct Apple{ int apple[4]; }; void fruit( struct Apple a, int b[x], unsigned char c) { return 0; } ================================ $ gcc-sp12 --version gcc (GCC) 12.0.0 20210704 (experimental) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ================================ $ gcc-sp12 test.c test.c:10:11: error: ‘x’ undeclared here (not in a function) 10 | int b[x], | ^ test.c:8:6: error: conflicting types for ‘fruit’; have ‘void(struct Apple, <type-error>, unsigned char)’ 8 | void fruit( | ^~~~~ test.c:12:1: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in c_type_promotes_to, at c/c-typeck.c:278 12 | { | ^ 0x7ad81c tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc-12-20210704/gcc/tree.c:8734 0x668e82 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc-12-20210704/gcc/tree.h:3496 0x668e82 c_type_promotes_to(tree_node*) ../../gcc-12-20210704/gcc/c/c-typeck.c:278 0x874d07 diagnose_arglist_conflict ../../gcc-12-20210704/gcc/c/c-decl.c:1826 0x874d07 diagnose_mismatched_decls ../../gcc-12-20210704/gcc/c/c-decl.c:2134 0x8767e4 duplicate_decls ../../gcc-12-20210704/gcc/c/c-decl.c:2956 0x8791a9 pushdecl(tree_node*) ../../gcc-12-20210704/gcc/c/c-decl.c:3149 0x88c359 start_function(c_declspecs*, c_declarator*, tree_node*) ../../gcc-12-20210704/gcc/c/c-decl.c:9642 0x8ea09e c_parser_declaration_or_fndef ../../gcc-12-20210704/gcc/c/c-parser.c:2440 0x8f2983 c_parser_external_declaration ../../gcc-12-20210704/gcc/c/c-parser.c:1777 0x8f33c9 c_parser_translation_unit ../../gcc-12-20210704/gcc/c/c-parser.c:1650 0x8f33c9 c_parse_file() ../../gcc-12-20210704/gcc/c/c-parser.c:22121 0x952ead c_common_parse_file() ../../gcc-12-20210704/gcc/c-family/c-opts.c:1219 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. ================================ $ gcc-sp11 --version gcc (GCC) 11.1.1 20210703 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ================================ $ gcc-sp11 test.c test.c:10:11: error: ‘x’ undeclared here (not in a function) 10 | int b[x], | ^ test.c:8:6: error: conflicting types for ‘fruit’; have ‘void(struct Apple, <type-error>, unsigned char)’ 8 | void fruit( | ^~~~~ test.c:12:1: note: an argument type that has a default promotion cannot match an empty parameter name list declaration 12 | { | ^ test.c:2:6: note: previous declaration of ‘fruit’ with type ‘void()’ 2 | void fruit(); | ^~~~~ test.c: In function ‘fruit’: test.c:13:10: warning: ‘return’ with a value, in function returning void 13 | return 0; | ^ test.c:8:6: note: declared here 8 | void fruit( | ^~~~~