https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79230
--- Comment #10 from janus at gcc dot gnu.org ---
(In reply to janus from comment #8)
> Another variant, which removes the naming collision (and dimension
> attribute) in the character components, in order to make things clearer:
>
>
> program main_ut
> implicit none
>
> type :: data_t
> character, allocatable :: c1
> end type
>
> type :: t1_t
> character, allocatable :: c2
> class(data_t), pointer :: width_data
> end type
>
> call evaluator
>
> contains
>
> subroutine evaluator
> type(data_t), target :: par_real
> type(t1_t) :: field
> field%width_data => par_real
> end subroutine
>
> end
With version 6.2, the dump for this case looks like:
evaluator ()
{
struct t1_t field;
struct data_t par_real;
try
{
field.c2 = 0B;
par_real.c1 = 0B;
(struct __vtype_main_ut_Data_t *) field.width_data._vptr =
&__vtab_main_ut_Data_t;
field.width_data._data = &par_real;
}
finally
{
if (par_real.c1 != 0B)
{
__builtin_free ((void *) par_real.c1);
}
par_real.c1 = 0B;
if (field.c2 != 0B)
{
__builtin_free ((void *) field.c2);
}
field.c2 = 0B;
}
}
I.e. any deallocation/finalization code for the width_data case is missing,
which is a potential memory leak.