[Patch, Fortran] PR 47797 - Improve line number for debugging

Tobias Burnus burnus@net-b.de
Sun Feb 20 13:55:00 GMT 2011


For a local variable such as
    character(len=:), allocatable :: str2
the code for generating the initial nullifying (and the final 
deallocation) happens at the end of procedures, thus input_location 
points to the last line.

This leads to strange locations if one does debugging. Before the patch, 
one has:

   character(kind=1)[1:3] * str2;

   [test.f90 : 6] try
     {
       [test.f90 : 6] str2 = 0B; /* This is the break point.  */
       [test.f90 : 4] [test.f90 : 4] __builtin_memcpy /* str1 = '1234'. */


With the patch:

   [hj4.f90 : 6] try
     {
       [hj4.f90 : 3] str2 = 0B;
       [hj4.f90 : 4] [hj4.f90 : 4] __builtin_memcpy ...


Build and currently regtesting on x86-64-linux.
OK for the trunk?

Tobias

PS: I have not tested all combinations; I think there is room for 
improvement and I hope that I have not introduced location regressions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: draft.diff
Type: text/x-patch
Size: 5988 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110220/b22bc61f/attachment.bin>


More information about the Fortran mailing list