------- Comment #18 from burnus at gcc dot gnu dot org 2010-09-09 19:33 ------- (In reply to comment #0) > This is pretty widespread. I have attached one example
That's now mostly fixed - though one patch is pending. Now gfortran -fdump-tree-original-lineno generates mostly sensible line numbers. For the given example, only for the DO loop the line numbers are a bit counter intuitive, given the line numbers 14 do i = 1,10 15 array1(i) = i 16 end do the dump of the internal representation (shown in a C-like syntax) is: [debug.f90 : 14] i = 1; [debug.f90 : 15] if ([debug.f90 : 15] i <= 10) ... [debug.f90 : 15] array1[[debug.f90 : 15] (integer(kind=8)) i + -1] = i; L.1:; [debug.f90 : 15] D.1577 = [debug.f90 : 15] i == 10; [debug.f90 : 15] i = [debug.f90 : 15] i + 1; [debug.f90 : 15] if (D.1577) goto L.2; The "i = 1" is in the expected line - as is the "array1(i) = i" assignment, but the loop increment and the exit conditions I would expect in line 14 and not in line 15. If no one else does, I will have a look after the last "input_location" patch has been committed. I expect that there are more cases where the annotation is slightly misplaced. If one looks at GCC 4.4, one finds: [debug.f90 : 14] i = 1; [debug.f90 : 14] if (i <= 10) [debug.f90 : 15] array1[(integer(kind=8)) i + -1] = i; L.1:; D.1550 = i == 10; i = i + 1; if (D.1550) goto L.2; Thus, the first loop condition is in the proper line (14) while there is no line number associated with the loop increment and the exit condition. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45186