[Patch, fortran] PR51976 - [F2003] Support deferred-length character components of derived types (allocatable string length)

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Mar 9 21:21:00 GMT 2014


On Sun, Mar 09, 2014 at 11:48:04AM -0700, Walter Spector wrote:
> Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> > ...
> >     deallocate(string)  ! Fix valgrind
> 
> I would agree in the case where 'string' had the pointer attribute.
> But with allocatables, valgrind should be seeing the memory block
> as 'still reachable'.
> 

Well, the string is still reachable at the end of the main
program, because the programmer has not deallocated the
memory.  Janus pointed to the PR where the behavior you are
seeing is discussed.  I don't recall all the details, but
as the program is terminating and all(most?) operating systems
return allocated memory to the OS, valgrind is essentially
reporting a false positive.

-- 
Steve



More information about the Fortran mailing list