https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121391
Bug ID: 121391 Summary: hard-reg constraints: ICE for undeclared variable Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gjl at gcc dot gnu.org Target Milestone: --- The following test terminates with an ICE after the correct error message: int use_hrc (void) { __asm volatile ("" :: "{eax}" (var)); } gcc use-hrc.c -S use-hrc.c: In function ‘use_hrc’: use-hrc.c:3:36: error: ‘var’ undeclared (first use in this function) 3 | __asm volatile ("" :: "{eax}" (var)); | ^~~ use-hrc.c:3:36: note: each undeclared identifier is reported only once for each function it appears in use-hrc.c:3:5: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in test, at gimplify_reg_info.h:48 3 | __asm volatile ("" :: "{eax}" (var)); | ^~~~~ 0x2445d11 internal_error(char const*, ...) ../../../source/gcc-master/gcc/diagnostic-global-context.cc:534 0x8b67f6 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../../source/gcc-master/gcc/tree.cc:9211 0x83d0d0 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../../source/gcc-master/gcc/tree.h:3878 0x83d0d0 gimplify_reg_info::test(HARD_REG_SET const&, int) const ../../../source/gcc-master/gcc/gimplify_reg_info.h:48 0x83d0d0 gimplify_reg_info::test_alt_input(unsigned int, int) const ../../../source/gcc-master/gcc/gimplify_reg_info.h:121 0x83d0d0 parse_input_constraint(char const**, int, int, int, int, char const* const*, bool*, bool*, gimplify_reg_info*) ../../../source/gcc-master/gcc/stmt.cc:620 0xde3cfd gimplify_asm_expr ../../../source/gcc-master/gcc/gimplify.cc:8161 0xdceab6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../../source/gcc-master/gcc/gimplify.cc:20226 0xdcfba6 gimplify_stmt(tree_node**, gimple**) ../../../source/gcc-master/gcc/gimplify.cc:8572 0xdd0c97 gimplify_bind_expr ../../../source/gcc-master/gcc/gimplify.cc:1687 0xdcdc73 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../../source/gcc-master/gcc/gimplify.cc:20094 0xdf2087 gimplify_stmt(tree_node**, gimple**) ../../../source/gcc-master/gcc/gimplify.cc:8572 0xdf2087 gimplify_body(tree_node*, bool) ../../../source/gcc-master/gcc/gimplify.cc:21200 0xdf2565 gimplify_function_tree(tree_node*) ../../../source/gcc-master/gcc/gimplify.cc:21409 0xbbcc47 cgraph_node::analyze() ../../../source/gcc-master/gcc/cgraphunit.cc:689 0xbbf847 analyze_functions ../../../source/gcc-master/gcc/cgraphunit.cc:1265 0xbc07dd symbol_table::finalize_compilation_unit() ../../../source/gcc-master/gcc/cgraphunit.cc:2575