https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92793
Bug ID: 92793 Summary: Fortran Location Data for Diagnostic lacks the column number – when passing on to ME Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- Currently, all location_t locations (such as gfc_current_locus->lb->location) always point to the beginning of the line, i.e. LOCATION_COLUMN(...) == 0. For front-end diagnostic, this is corrected in gcc/fortran/error.c's gfc_format_decoder using: unsigned int offset = loc->nextc - loc->lb->line; int loc_num = text->get_location (0) == UNKNOWN_LOCATION ? 0 : 1; location_t src_loc = linemap_position_for_loc_and_offset (line_table, loc->lb->location, offset); But this correction does not happen when setting the location for 'tree', e.g.: build_decl (ns->proc_name->declared_at.lb->location or tmp = fold_build1_loc (code->expr1->where.lb->location, LOOP_EXPR or … The question is how to fix this best. My feeling is that it should already be fixed in the scanner such that loc->lb->location is always correct and we can get rid off the offset calculation in error.c