This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46174] [OOP] ALLOCATE with SOURCE: Deep copy missing
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 26 Oct 2010 13:27:16 +0000
- Subject: [Bug fortran/46174] [OOP] ALLOCATE with SOURCE: Deep copy missing
- Auto-submitted: auto-generated
- References: <bug-46174-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46174
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |domob at gcc dot gnu.org
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-26 13:27:11 UTC ---
Possible implementation scheme: vtab$t contains besides the normal type-bound
procedures and init/size/hash also an two function points: $copy and $free,
which are of the kind:
void $free (struct *DT) {
... free derived types
if (DT->$vtab->$extends && DT->$vtab->$extends->$free)
DT->$vtab->$extends->$free (DT)
}
That is, each effective type cleans up its own allocatable components and moves
on to the parent. If the parent does not have an allocatable component itself,
the $free pointer directly points to an ancestor which has -- or is NULL if no
such ancestor exists. The $copy version works alike.