https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107307
Bug ID: 107307 Summary: ICE tree check: expected class 'type', have 'exceptional' (error_mark) in canonicalize_component_ref, at gimplify.cc:2923 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Started with r12 between 20210822 and 20210905 : $ cat z1.c void f () { const struct { int a[1]; } b; int *c = b.a; int *b; } $ gcc-13-20221016 -c z1.c z1.c: In function 'f': z1.c:4:12: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 4 | int *c = b.a; | ^ z1.c:5:8: error: conflicting type qualifiers for 'b' 5 | int *b; | ^ z1.c:3:30: note: previous declaration of 'b' with type 'const struct <anonymous>' 3 | const struct { int a[1]; } b; | ^ z1.c:4:13: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in canonicalize_component_ref, at gimplify.cc:2923 4 | int *c = b.a; | ~^~ 0x6acb6d tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/tree.cc:8886 0xb8578e tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc/tree.h:3649 0xb8578e canonicalize_component_ref ../../gcc/gimplify.cc:2923 0xba3857 gimplify_compound_lval ../../gcc/gimplify.cc:3326 0xb9753a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16280 0xbaa91a gimplify_addr_expr ../../gcc/gimplify.cc:6529 0xb9913d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16375 0xba931f gimplify_modify_expr ../../gcc/gimplify.cc:6121 0xb998f7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16328 0xb9d7d8 gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7187 0xba2343 gimplify_and_add(tree_node*, gimple**) ../../gcc/gimplify.cc:492 0xba2343 gimplify_decl_expr ../../gcc/gimplify.cc:1938 0xb988b2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16525 0xb9d7d8 gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7187 0xb98bcb gimplify_statement_list ../../gcc/gimplify.cc:2021 0xb98bcb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16773 0xb9d7d8 gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7187 0xb9e163 gimplify_bind_expr ../../gcc/gimplify.cc:1430 0xb990da gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:16529 0xb9d7d8 gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:7187