[Patch, Fortran] PR 45186 - Improve location of expressions for debugging

Tobias Burnus burnus@net-b.de
Wed Oct 13 10:49:00 GMT 2010


  PR 45186 is "[4.6 Regression] Gfortran 4.5.0 emits wrong linenumbers". 
While most of it was fixed, I found two cases where the location was 
wrong or at least surprising. That's fixes with the following patch. I 
am sure there are more cases, but I intent to close the PR after those 
fixes are in.

Currently, one has surprising locations (cf. -fdump-tree-original-lineno 
[note the "-lineno"]) for:
   if (cond)
     a = b
   end if
as the condition has the line number of "a = b". Analogously for
   do while (cond)
      j = i
   end do

For DO loops,
   do i = 1, 2  ! or "i = 1, 2, k" which is handled differently
     j = i
     k = j
   end do
many generated expressions are in the "j = i" or in the "k = i" line. 
When trying, also use -fcheck=do to generate get more expressions.

While for "if (cond)" and for "do while(cond)" the line number is 
naturally given by the DO/IF statement, for DO loops it gets more 
complicated: To which line do you associate the loop-exit check, the 
initializations, the increment, ...? The patch mostly puts them into the 
DO line.

Build and currently regtesting.
OK for the trunk?

Tobias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug-lines.diff
Type: text/x-patch
Size: 20805 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20101013/89a35abd/attachment.bin>


More information about the Fortran mailing list