https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116735
Bug ID: 116735 Summary: ICE in build_counted_by_ref Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- Created attachment 59121 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59121&action=edit test case foo.c Seen with gcc-15-20240908 snapshot: $ gcc -I. foo.c -Wall foo.c:4:7: error: argument ‘lenx’ to the ‘counted_by’ attribute is not a field declaration in the same structure as ‘element’ 4 | int element[] __attribute__ ((__counted_by__ (lenx))); | ^~~~~~~ In function ‘main’: cc1: error: ‘struct foo’ has no member named ‘lenx’; did you mean ‘len’? foo.c:11:3: internal compiler error: in build_counted_by_ref, at c/c-typeck.cc:2705 11 | p->element[0] = 17; | ^ 0x252916e internal_error(char const*, ...) ../../gcc-15-20240908/gcc/diagnostic-global-context.cc:492 0x98b7ad fancy_abort(char const*, int, char const*) ../../gcc-15-20240908/gcc/diagnostic.cc:1658 0x7578b0 build_counted_by_ref ../../gcc-15-20240908/gcc/c/c-typeck.cc:2705 0x7578b0 build_component_ref(unsigned int, tree_node*, tree_node*, unsigned int, unsigned int, bool) ../../gcc-15-20240908/gcc/c/c-typeck.cc:2853 0xa1b12e c_parser_postfix_expression_after_primary ../../gcc-15-20240908/gcc/c/c-parser.cc:12834 0xa0089f c_parser_postfix_expression ../../gcc-15-20240908/gcc/c/c-parser.cc:12309 0xa04f9a c_parser_unary_expression ../../gcc-15-20240908/gcc/c/c-parser.cc:9942 0xa06b88 c_parser_cast_expression ../../gcc-15-20240908/gcc/c/c-parser.cc:9783 0xa06f5a c_parser_binary_expression ../../gcc-15-20240908/gcc/c/c-parser.cc:9551 0xa084e3 c_parser_conditional_expression ../../gcc-15-20240908/gcc/c/c-parser.cc:9246 0xa08ce4 c_parser_expr_no_commas ../../gcc-15-20240908/gcc/c/c-parser.cc:9159 0xa09131 c_parser_expression ../../gcc-15-20240908/gcc/c/c-parser.cc:12897 0xa095f5 c_parser_expression_conv ../../gcc-15-20240908/gcc/c/c-parser.cc:12937 0xa2daaf c_parser_statement_after_labels ../../gcc-15-20240908/gcc/c/c-parser.cc:7848 0xa00329 c_parser_compound_statement_nostart ../../gcc-15-20240908/gcc/c/c-parser.cc:7324 0xa29d84 c_parser_compound_statement ../../gcc-15-20240908/gcc/c/c-parser.cc:6574 0xa2c0ab c_parser_declaration_or_fndef ../../gcc-15-20240908/gcc/c/c-parser.cc:3032 0xa36b1b c_parser_external_declaration ../../gcc-15-20240908/gcc/c/c-parser.cc:2060 0xa3755d c_parser_translation_unit ../../gcc-15-20240908/gcc/c/c-parser.cc:1914 0xa3755d c_parse_file() ../../gcc-15-20240908/gcc/c/c-parser.cc:27337 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.