https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54224
--- Comment #28 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Dominique d'Humieres from comment #27) > > At some moment, the Fortran FE sets DECL_SOURCE_LOCATION() on a tree, > > probably using loc->lb->line. Finding out where this happens probably > > requires a bit of debugging. > > /* Set the backend source location of a decl. */ > > void > gfc_set_decl_location (tree decl, locus * loc) > { > DECL_SOURCE_LOCATION (decl) = loc->lb->location; > } > > in gcc/fortran/trans-decl.c? I guess you can always try, but yes it looks one place that could be fixed. I suggest to add a wrapper function. Something like: location_t gfc_location_from_locus (const locus * loc) { unsigned int offset = loc->nextc - loc->lb->line; return linemap_position_for_loc_and_offset (line_table, loc->lb->location, offset)); } I think there is at least one place already that could use this wrapper.