This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] Plug memory leaks; fix tree-check ICE for PR


On 08/26/2012 08:12 PM, Tobias Burnus wrote:
This patch fixes one ICE and several memory leaks. But there are more.


I have now committed the patch with the following additional patch * module.c (mio_symbol): Don't increase sym->refs for its use in sym->formal_ns->proc_name.

The patch for the ICE (PR54370) was committed as Rev. 190709, the rest (memory leakage, including PR41093) as Rev. 190710.

The additional patch is required as otherwise sym->refs is too high for gfc_free_symbol - and gfc_free_namespace doesn't free (and thus decrement) ns->proc_name.


I have regtested and tested the patch with a couple of programs, I also checked some with valgrind; the leakage decreased quit a bit but there are still known leaks, cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54384


I do hope that the patch didn't cause any regression, but I do not rule out problems in some special situations as the memory handling is not always that transparent.

Tobias


--- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -3807,10 +3807,7 @@ mio_symbol (gfc_symbol *sym) { mio_namespace_ref (&sym->formal_ns); if (sym->formal_ns) - { - sym->formal_ns->proc_name = sym; - sym->refs++; - } + sym->formal_ns->proc_name = sym; }

/* Save/restore common block links. */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]