Looks good and simple. Proceed. Thanks
Jerry
On 10/28/21 5:05 PM, Bernhard Reutner-Fischer via Fortran wrote:
ping
[Rebased, re-regtested cleanly. Ok for trunk?]
On Wed, 5 Sep 2018 14:57:31 +0000
Bernhard Reutner-Fischer <rep.dot....@gmail.com> wrote:
From: Bernhard Reutner-Fischer <al...@gcc.gnu.org>
compiling gfortran.dg/typebound_proc_31.f90 leaked the type-bound
structs:
56 bytes in 1 blocks are definitely lost.
at 0x4C2CC05: calloc (vg_replace_malloc.c:711)
by 0x151EA90: xcalloc (xmalloc.c:162)
by 0x8E3E4F: gfc_get_typebound_proc(gfc_typebound_proc*) (symbol.c:4945)
by 0x84C095: match_procedure_in_type (decl.c:10486)
by 0x84C095: gfc_match_procedure() (decl.c:6696)
...
gcc/fortran/ChangeLog:
2017-12-06 Bernhard Reutner-Fischer <al...@gcc.gnu.org>
* symbol.c (free_tb_tree): Free type-bound procedure struct.
(gfc_get_typebound_proc): Use explicit memcpy for clarity.
---
gcc/fortran/symbol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 53c760a6c38..cde34c67482 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -3845,7 +3845,7 @@ free_tb_tree (gfc_symtree *t)
/* TODO: Free type-bound procedure structs themselves; probably needs some
sort of ref-counting mechanism. */
-
+ free (t->n.tb);
free (t);
}
@@ -5052,7 +5052,7 @@ gfc_get_typebound_proc (gfc_typebound_proc *tb0)
result = XCNEW (gfc_typebound_proc);
if (tb0)
- *result = *tb0;
+ memcpy (result, tb0, sizeof (gfc_typebound_proc));;
result->error = 1;
latest_undo_chgset->tbps.safe_push (result);