https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89334
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Stas Sergeev from comment #4) > Would it be possible to at least show the > correct line number where the register allocation > actually failed? gcc points to a rather "random" > line Hmm, getting a "correct" location is doable. Something like: diff --git a/gcc/final.c b/gcc/final.c index f6edd6a1dfc..ab85f7dce91 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -2690,6 +2690,7 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, rtx *ops = XALLOCAVEC (rtx, noperands); const char *string; location_t loc; + location_t saved_loc; expanded_location expanded; /* There's no telling what that did to the condition codes. */ @@ -2702,6 +2703,10 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, this_is_asm_operands = insn; expanded = expand_location (loc); + saved_loc = input_location; + input_location = loc; + + #ifdef FINAL_PRESCAN_INSN FINAL_PRESCAN_INSN (insn, ops, insn_noperands); #endif @@ -2725,6 +2730,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, insn_noperands); this_is_asm_operands = 0; + + input_location = saved_loc; break; } Untested (both building and running).