https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79165
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, so the reason for the slowness is that the Fortran frontend emits full diagnostics to a temporary buffer for gfc_match_rvalue: /* Match a function reference. */ function0: m = gfc_match_actual_arglist (0, &actual_arglist); if (m == MATCH_NO) { if (sym->attr.proc == PROC_ST_FUNCTION) gfc_error ("Statement function %qs requires argument list at %C", sym->name); else gfc_error ("Function %qs requires an argument list at %C", sym->name); m = MATCH_ERROR; break; } for aermod that's 18748 times. And what slows down with the linemap mangling is showing of the caret location (location_get_source_line/get_next_line and thus the fcache I suppose). Tentatively remembering an error like above is of course quite broken (read: expensive). So somehow with the tree.c hunk of the patch location_get_source_line (inclusive callees) gets 90 times more expensive (when using callgrind on aermod).