https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60922
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #9 from janus at gcc dot gnu.org ---
Looking at the dump of the finalizer function (__final_test_leak_D_vect_type)
shows that it indeed has code to free the component v:
if (fini_coarray)
{
{
integer(kind=4) stat.5;
if (ptr->v._data == 0B)
{
stat.5 = 1;
}
else
{
if (ptr->v._vptr->_final != 0B)
{
{
struct array0_d_base_vect_type desc.6;
desc.6.dtype = 40;
desc.6.data = (void * restrict) ptr->v._data;
ptr->v._vptr->_final (&desc.6, ptr->v._vptr->_size, 0);
}
}
__builtin_free ((void *) ptr->v._data);
stat.5 = 0;
}
However, it is guarded by the check for 'fini_coarray', which is the third
argument of the finalizer function and is being set to zero on invocation:
x._vptr->_final (&desc.8, x._vptr->_size, 0);
The documentation of 'generate_finalization_wrapper' in class.c says:
If "fini_coarray" is false, coarray components are not finalized to allow for
the correct semantic with intrinsic assignment.
So I guess it should only apply to COARRAY components, not to CLASS components.
Tobias: I guess you were the one who implemented it. Could you please comment
on this?