diff mbox

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

Message ID CAKwh3qjQzp3qDaA=Y62KiL2Ed_As5bz9AKu+Cd69hLAMahdDJw@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Jan. 18, 2015, 10:46 a.m. UTC
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.

Comments

Janus Weil Jan. 22, 2015, 3:37 p.m. UTC | #1
Ping!



2015-01-18 11:46 GMT+01:00 Janus Weil <janus@gcc.gnu.org>:
> 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.
Paul Richard Thomas Jan. 22, 2015, 4:38 p.m. UTC | #2
Dear Janus,

As it happens I loaded this patch up last night to see if I could plug
the last leak in my patch for PR63205, which is making heavy use of
the default finalizers. It seemed to do the job. As you said in the PR
it appears to be a typo and really is obvious. I can canfirm that it
bootstraps and regtests OK.

Good for 4.9 and 5.0

Thanks for the patch

Paul

On 22 January 2015 at 16:37, Janus Weil <janus@gcc.gnu.org> wrote:
> Ping!
>
>
>
> 2015-01-18 11:46 GMT+01:00 Janus Weil <janus@gcc.gnu.org>:
>> 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.
Janus Weil Jan. 23, 2015, 8:33 a.m. UTC | #3
2015-01-22 17:38 GMT+01:00 Paul Richard Thomas <paul.richard.thomas@gmail.com>:
> As it happens I loaded this patch up last night to see if I could plug
> the last leak in my patch for PR63205, which is making heavy use of
> the default finalizers. It seemed to do the job. As you said in the PR
> it appears to be a typo and really is obvious. I can canfirm that it
> bootstraps and regtests OK.
>
> Good for 4.9 and 5.0

Committed to trunk as r220029. Will backport to 4.9 on the weekend.
Thanks for reviewing!

Cheers,
Janus



> On 22 January 2015 at 16:37, Janus Weil <janus@gcc.gnu.org> wrote:
>> Ping!
>>
>>
>>
>> 2015-01-18 11:46 GMT+01:00 Janus Weil <janus@gcc.gnu.org>:
>>> 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.
>
>
>
> --
> Outside of a dog, a book is a man's best friend. Inside of a dog it's
> too dark to read.
>
> Groucho Marx
diff mbox

Patch

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)