[Patch, Fortran, OOP] PR 60922: [4.9/5 regression] Memory leak with allocatable CLASS components

Janus Weil janus@gcc.gnu.org
Sun Jan 18 10:47:00 GMT 2015


Hi all,

the attached patch is close to trivial and fixes a memory-leak
regression that appeared after the implementation of finalization.

My suspicion it that it's simply a copy'n'paste error, where the wrong
attribute was copied from very similar code a few lines above, but I'd
like to have that confirmed by the original author (which should be
Tobias).

Regtested on x86_64-unknown-linux-gnu. Ok for trunk and 4.9?

Cheers,
Janus


2015-01-18  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/60922
    * class.c (finalize_component): Apply the check for 'fini_coarray' only
    to coarray components.

2015-01-18  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/60922
    * gfortran.dg/class_allocate_17.f90: Extended.
-------------- next part --------------
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c	(Revision 219813)
+++ gcc/fortran/class.c	(Arbeitskopie)
@@ -875,7 +875,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *de
       /* Add IF (fini_coarray).  */
       if (comp->attr.codimension
 	  || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)
-	      && CLASS_DATA (comp)->attr.allocatable))
+	      && CLASS_DATA (comp)->attr.codimension))
 	{
 	  block = gfc_get_code (EXEC_IF);
 	  if (*code)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: class_allocate_17.f90
Type: text/x-fortran
Size: 636 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150118/0c109b4c/attachment.bin>


More information about the Fortran mailing list