Hi Tobias! On 2020-10-30T12:16:05+0100, Tobias Burnus wrote: > On 30.10.20 11:47, Thomas Schwinge wrote: >>>> Fixed by introducing a new function; now one only needs to make sure >>>> that no new code will re-introduce "lb->location":-) >> ... another*existing instance* of this problem. > ... >> gfc_set_backend_locus (locus * loc) >> { >> gfc_current_backend_file = loc->lb->file; >> - input_location = loc->lb->location; >> + input_location = gfc_get_location (loc); >> } > > In bare usage, it seems to be fine – which are 23 callers. > > However, there is additionally: > > gfc_save_backend_locus (locus * loc) > { > loc->lb = XCNEW (gfc_linebuf); > loc->lb->location = input_location; > loc->lb->file = gfc_current_backend_file; > } > > which is used together with: > > gfc_restore_backend_locus (locus * loc) > { > gfc_set_backend_locus (loc); > free (loc->lb); > } > > I think the latter needs to be replaced by the previous > version of "gfc_save_backend_locus" for two related reasons: > > * gfc_save_backend_locus operates with incomplete data, > i.e. loc->nextc (used by gfc_get_location) might not > be set. > * input_location might/should already contain the column > offset – and you do not want to add some random offset > to it. > > Hence: LGTM – if you update 'gfc_restore_backend_locus' > by inlining the previous version of 'gfc_set_backend_locus'. Thanks for the review; absolutely right, sorry for not realizing that on my own. Thusly changed, see attached, pushed "Further improve Fortran column location information [PR92793]" to master branch in commit 5677444f7e7ca15557030902c3d09dab4852fa90, and backported to releases/gcc-10 branch in commit a5c5f9e181c1f7548930f1cab91002b9d460cc92. Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter