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

W Spector w6ws@earthlink.net
Mon Mar 10 14:27:00 GMT 2014


All,

Valgrind does not report "false positives" for other allocatable 
variables in the main program.  Deferred length character variables 
should not be any different.  In a main program they should all have the 
'save' attribute as required by the F2008 Standard.  So their 
allocations should persist through the end of the program execution. 
Again, valgrind should be reporting "still reachable", not "definitely 
lost".

Walter

On 03/09/2014 02:20 PM, Steve Kargl wrote:
> 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.
>



More information about the Fortran mailing list