https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67933
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #2)
> The generated finalization wrapper has code doing
> deallocate(ptr2%classes(:)%class_var)
> where ptr2 is a pointer of type list_t to be finalized.
> This is missing scalarization, a correct code would do instead:
> do i=1,size(ptr2)
> ptr3 => ptr2%classes(i)
> deallocate (ptr3%class_var)
> end do
Hi Mikael,
This does not seem to be the problem. It is actually the
gfc_reset_vptr (&se.pre, al->expr);
at trans-stmt.c:6048.
Once gfc_reset_vptr is modified to quit if it doesn't find a vptr, compilation
succeeds and the finalizer has:
S.7 = 0;
while (1)
{
if (S.7 > 9) goto L.11;
if (ptr2->classes[S.7].class_var._data != 0B &&
ptr2->classes[S.7].class_var._vptr->_final != 0B)
{
desc.8.dtype = 296;
desc.8.data = (void * restrict) ptr2->classes[S.7].class_var._data;
ptr2->classes[S.7].class_var._vptr->_final (&desc.8, (integer(kind=8))
ptr2->classes[S.7].class_var._vptr->_size, 1);
}
if (ptr2->classes[S.7].class_var._data != 0B)
{
__builtin_free ((void *) ptr2->classes[S.7].class_var._data);
}
ptr2->classes[S.7].class_var._data = 0B;
S.7 = S.7 + 1;
}
L.11:;
I'll post the patch as soon as I understand where the vptr's go to.
Cheers
Paul