[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    Re: [Patch, Fortran, PR 64787 a.o., v2] Invalid code on sourced allocation of class(*) character str
From:       Jerry DeLisle <jvdelisle () charter ! net>
Date:       2015-03-21 4:46:15
Message-ID: 550CF797.5090303 () charter ! net
[Download RAW message or body]

On 03/20/2015 09:10 PM, Jerry DeLisle wrote:
> On 03/20/2015 10:08 AM, Dominique d'Humières wrote:
>> Dear Andre,
>>
>> This patch fixes the issues I have reported in my previous mail. In addition
>> it allows the Metcalf's oo.f90 to compiles and gives sensible results at run
>> time (yes, I have noticed the patch to fix the memory leak, and it works).
>
> I think I have the various patches applied in sequence OK.  With Valgrind I am
> seeing the following on the metcalf.f90 case.  I am looking at the metcalf
> example code itself to see if it is not deallocating something.  I have not
> found anything yet.

OK, I actually found a problem in the delete_list function of the example 
program where not all items in the list were being "deleted".

Was:

   subroutine delete_list(list)
     class(anylist), intent(inout) :: list
     do
       if (.not.associated(list%firstptr)) exit
       call delete(list%firstptr)
     end do

Fixed:

   subroutine delete_list(list)
     class(anylist), intent(inout) :: list
     class(anyitem), pointer :: p, next
     p => list%firstptr
     do
       if (.not.associated(p)) exit
       next => p%nextptr
       call delete(p)
       p => next
     end do
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic