https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121205
--- Comment #2 from Stefan Schulze Frielinghaus <stefansf at gcc dot gnu.org> --- (In reply to Sam James from comment #1) > With checking, I also see: > > +FAIL: gcc.target/i386/asm-hard-reg-1.c (internal compiler error: RTL check: > expected elt 3 type 'e' or 'u', have '0' (rtx note) in PATTERN, at > rtl.h:1523) > +FAIL: gcc.target/i386/asm-hard-reg-2.c (internal compiler error: RTL check: > expected elt 3 type 'e' or 'u', have '0' (rtx note) in PATTERN, at > rtl.h:1523) The checking error occurs for void test (void) { int x, y; __asm__ __volatile__ ("" : "={rdx}" (x), "=d" (y)); // expect error __asm__ __volatile__ ("" :: "{rdx}" (x), "d" (y)); // expect error __asm__ __volatile__ ("" : "=S" (x), "={rsi}" (y)); // expect error } were for each line we expect an error during LRA coming from void lra_asm_insn_error (rtx_insn *insn) { lra_asm_error_p = true; error_for_asm (insn, "%<asm%> operand has impossible constraints" " or there are not enough registers"); /* Avoid further trouble with this insn. */ if (JUMP_P (insn)) { ira_nullify_asm_goto (insn); lra_invalidate_insn_data (insn); } else { PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx); lra_set_insn_deleted (insn); } } were we also set the pattern to zero in the else case. In curr_insn_transform(), if an error occurs we still call in the end lra_process_new_insns() with a insn deleted note. Instead we probably should just return after reporting the error: diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index 83f8fda3b52..dc3c224a097 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -4929,7 +4929,10 @@ curr_insn_transform (bool check_only_p) if (asm_noperands (PATTERN (curr_insn)) >= 0 && ++curr_id->asm_reloads_num >= FIRST_PSEUDO_REGISTER) /* Most probably there are no enough registers to satisfy asm insn: */ - lra_asm_insn_error (curr_insn); + { + lra_asm_insn_error (curr_insn); + return change_p; + } } if (goal_alt_out_sp_reload_p) {