This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/60922] [4.9/5 regression] Memory leak with INTENT(OUT) CLASS argument w/ allocatable CLASS components
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 17 Jan 2015 16:09:17 +0000
- Subject: [Bug fortran/60922] [4.9/5 regression] Memory leak with INTENT(OUT) CLASS argument w/ allocatable CLASS components
- Auto-submitted: auto-generated
- References: <bug-60922-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60922
--- Comment #7 from janus at gcc dot gnu.org ---
Looking at the output of -fdump-tree-original for comment 6, one sees with 4.8:
d_vect_bld_x (struct __class_test_leak_D_vect_type & restrict x)
{
if (x->_data->v._data != 0B)
{
__builtin_free ((void *) x->_data->v._data);
}
while trunk shows:
d_vect_bld_x (struct __class_test_leak_D_vect_type_t & restrict x)
{
if (x->_vptr->_final != 0B)
{
{
struct array0_d_vect_type desc.7;
desc.7.dtype = 1064;
desc.7.data = (void * restrict) x->_data;
x->_vptr->_final (&desc.7, x->_vptr->_size, 0);
}
}
That is: In 4.8 the argument x is directly freed when entering the function. On
trunk (after the implementation of finalization) the _final routine is called
instead. Apparently the latter fails to properly free the allocatable class
component.