This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Derived-type finalization, split up: module.c part
- From: Daniel Kraft <d at domob dot eu>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 05 Aug 2008 11:41:10 +0200
- Subject: Re: [Patch, Fortran] Derived-type finalization, split up: module.c part
- References: <4896F78B.9000009@domob.eu> <339c37f20808050153s77fa5110jec3ed4064f86284@mail.gmail.com>
Hi Paul,
Paul Richard Thomas wrote:
Is it ok to check this change in without direct tests for it in the
test-suite? But those will follow in the full finalizer patch and in fact
this code is tested by those tests.
OK subject to dealing with comments below.
Thanks for this patch and the huge amount of work that you are doing.
If you can feed more fragments like this to me this would be kinder on
my head!
I'll try to do so as far as possible! But I think after this patch,
maybe typebound procedures are more important... But I'm still trying
to think of a scheme to allow temporary generation in the front-end for
getting finalization finally working right.
One comment below, ok to check in? The other comments have been removed
as obvious, I'll write a changelog entry of course.
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 138574)
+++ gcc/fortran/symbol.c (working copy)
@@ -2965,9 +2965,13 @@ gfc_free_finalizer (gfc_finalizer* el)
{
if (el)
{
- --el->procedure->refs;
- if (!el->procedure->refs)
- gfc_free_symbol (el->procedure);
+ if (el->proc_sym)
+ {
+ --el->proc_sym->refs;
+ if (!el->proc_sym->refs)
+ gfc_free_symbol (el->proc_sym);
+ }
+ /* XXX: Do we need to do something (deref) for the tree? */
Hmmm! That said, we are cleaning up and freeing the f2k_derived
namespace and the gfc_finalizers at the end of compilation, I trust?
We call gfc_free_namespace in gfc_free_symbol; that should do the trick,
shouldn't it?
If that's ok, I'll simply remove the comment.
Thanks for the review,
Daniel
--
Done: Arc-Bar-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
Underway: Cav-Dwa-Law-Fem
To go: Cav-Hea-Kni-Mon-Pri-Ran-Rog-Tou