https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69080
Bug ID: 69080
Summary: No automatic deallocation of allocatable function
results
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Created attachment 37186
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37186&action=edit
Test program and module
Note: This is my first bug report
I noticed that allocatable function results are not always deallocated. I'm
actually not sure if this is correct behavior or not.
See code attachment for test prog.
Architecture is Debian GNU/Linux 8.2 (jessie) x86_64, gfortran has only been
called with "gfortran dummy_module.f90 prog.f90". "valgrind --leak-check=full
./a.out" then tells me:
==26772== Memcheck, a memory error detector
==26772== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==26772== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==26772== Command: ./a.out
==26772==
==26772==
==26772== HEAP SUMMARY:
==26772== in use at exit: 1 bytes in 1 blocks
==26772== total heap usage: 25 allocs, 24 frees, 12,832 bytes allocated
==26772==
==26772== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1
==26772== at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==26772== by 0x400828: __dummy_module_MOD_dummy_create_allocatable (in
XXXX/a.out)
==26772== by 0x4007C4: __dummy_module_MOD_dummy_trigger (in XXXX/a.out)
==26772== by 0x4008CA: MAIN__ (in XXXX/a.out)
==26772== by 0x400990: main (in XXXX/a.out)
==26772==
==26772== LEAK SUMMARY:
==26772== definitely lost: 1 bytes in 1 blocks
==26772== indirectly lost: 0 bytes in 0 blocks
==26772== possibly lost: 0 bytes in 0 blocks
==26772== still reachable: 0 bytes in 0 blocks
==26772== suppressed: 0 bytes in 0 blocks
==26772==
==26772== For counts of detected and suppressed errors, rerun with: -v
==26772== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Is this correct behavior? If so, why?
Thanks in advance.