[Bug fortran/56491] New: [OOP] Memory leak with vtab's type-bound-procedures
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 1 09:55:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56491
Bug #: 56491
Summary: [OOP] Memory leak with vtab's type-bound-procedures
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org
gfc_find_derived_vtab (gfc_symbol *derived)
...
if (gfc_add_component (vtype, "_copy", &c) == FAILURE)
goto cleanup;
c->attr.proc_pointer = 1;
c->attr.access = ACCESS_PRIVATE;
c->tb = XCNEW (gfc_typebound_proc);
The "c->tb" leaks memory; similarly for gfc_find_intrinsic_vtab.
Example:
class(*), allocatable :: A
allocate(integer :: a)
select type(a)
type is (integer)
a= 5
print *, a
end select
end
Looking at source.c, free_components does not handle TBP. Those are only freed
via gfc_free_namespace:
free_tb_tree (ns->tb_sym_root);
free_tb_tree (ns->tb_uop_root);
but vtab's tb do not end up in those symtrees.
More information about the Gcc-bugs
mailing list