* [Bug fortran/94361] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
@ 2020-05-18 19:11 ` anlauf at gcc dot gnu.org
2020-05-18 19:12 ` anlauf at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-05-18 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.1.1, 11.0, 7.4.1, 8.2.1,
| |8.3.1, 9.3.1
Summary|Regression: Memory leak in |Memory leak in nested types
|nested types with final |with final
Last reconfirmed| |2020-05-18
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |anlauf at gcc dot gnu.org
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed regarding the memory leak.
Cannot confirm as regression. My 8.2.1 (OpenSuse) leaks the same as other
versions according to valgrind.
Regression marker therefore removed.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
2020-05-18 19:11 ` [Bug fortran/94361] " anlauf at gcc dot gnu.org
@ 2020-05-18 19:12 ` anlauf at gcc dot gnu.org
2020-05-18 21:30 ` antony at cosmologist dot info
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-05-18 19:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Priority|P3 |P4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
2020-05-18 19:11 ` [Bug fortran/94361] " anlauf at gcc dot gnu.org
2020-05-18 19:12 ` anlauf at gcc dot gnu.org
@ 2020-05-18 21:30 ` antony at cosmologist dot info
2020-05-19 9:15 ` antony at cosmologist dot info
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: antony at cosmologist dot info @ 2020-05-18 21:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #2 from Antony Lewis <antony at cosmologist dot info> ---
I tried it on another system where gfortran 6.5 and 7.4.0 that don't leak, but
8.4.0 does, so in that sense at least I think it is a regression.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (2 preceding siblings ...)
2020-05-18 21:30 ` antony at cosmologist dot info
@ 2020-05-19 9:15 ` antony at cosmologist dot info
2020-05-21 10:39 ` [Bug fortran/94361] [8/9/10/11 Regression] " anlauf at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: antony at cosmologist dot info @ 2020-05-19 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #3 from Antony Lewis <antony at cosmologist dot info> ---
On Windows 8.1.0 does not leak, and on NERSC 8.3.0 20190222 (Cray Inc.) also
does not (but 9.2.0 does)... so not exactly sure what this means about when it
was introduced.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (3 preceding siblings ...)
2020-05-19 9:15 ` antony at cosmologist dot info
@ 2020-05-21 10:39 ` anlauf at gcc dot gnu.org
2020-05-23 19:13 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-05-21 10:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |6.5.0, 7.2.0, 7.4.0, 8.1.0
Target Milestone|--- |8.5
Summary|Memory leak in nested types |[8/9/10/11 Regression]
|with final |Memory leak in nested types
| |with final
Known to fail| |9.2.0
--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to Antony Lewis from comment #3)
> On Windows 8.1.0 does not leak, and on NERSC 8.3.0 20190222 (Cray Inc.) also
> does not (but 9.2.0 does)... so not exactly sure what this means about when
> it was introduced.
So adding to known-to-work/fail.
I found a Debian machine with 7.2.0 and compared the dump tree with that of
7.4.1. There is clearly a chunk of code related to finalization present in
7.2.0, but it is missing in 7.4.1:
if (&ptr2->t != 0B)
{
{
integer(kind=4) stat.5;
if ((real(kind=4)[0:] * restrict) ptr2->t.dat.data == 0B)
{
stat.5 = 1;
}
else
{
__builtin_free (ptr2->t.dat.data);
(real(kind=4)[0:] * restrict) ptr2->t.dat.data = 0B;
stat.5 = 0;
}
if (stat.5 != 0) goto L.9;
L.9:;
ignore = stat.5;
}
}
L.8:;
{
struct array0_typewithfinal desc.6;
desc.6.dtype = 40;
desc.6.data = (void * restrict) &ptr2->t.x;
__final_debug_Typewithfinal (&desc.6);
}
Looking at the changes to the 7 series leading to 7.4.1 might indicate the
which commit (or backport) caused this.
Marking as (7)/8/9/10/11 regression.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (4 preceding siblings ...)
2020-05-21 10:39 ` [Bug fortran/94361] [8/9/10/11 Regression] " anlauf at gcc dot gnu.org
@ 2020-05-23 19:13 ` anlauf at gcc dot gnu.org
2020-05-24 12:26 ` tkoenig at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-05-23 19:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu.org
--- Comment #5 from anlauf at gcc dot gnu.org ---
Reverting the commit
commit b81f7b83631be7dedcdcf44eed6dd575ada3ac23
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date: Sat Apr 6 22:10:28 2019 +0000
re PR fortran/87352 (Large stack usage with new gfortran)
2019-04-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87352
* gfortran.h (gfc_component): Add finalized field.
* class.c (finalize_component): If the component is already
finalized, return early. Set component->finalized on exit.
2019-04-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/87352
* gfortran.dg/finalize_28.f90: Adjust count of __builtin_free.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: New test.
From-SVN: r270184
fixes the memory leak.
CCing Thomas.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (5 preceding siblings ...)
2020-05-23 19:13 ` anlauf at gcc dot gnu.org
@ 2020-05-24 12:26 ` tkoenig at gcc dot gnu.org
2020-05-31 10:00 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-05-24 12:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (6 preceding siblings ...)
2020-05-24 12:26 ` tkoenig at gcc dot gnu.org
@ 2020-05-31 10:00 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:16 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-31 10:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Kथà¤nig <tkoenig@gcc.gnu.org>:
https://gcc.gnu.org/g:811f902b764c5a13178cbd7588e96c16b3fab504
commit r11-749-g811f902b764c5a13178cbd7588e96c16b3fab504
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date: Sun May 31 10:26:40 2020 +0200
Finalization depends on the expression, not on the component.
This patch fixes a 8/9/10/11 regression, where finalized types
were not finalized (and deallocated), which led to memory
leaks.
gcc/fortran/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* class.c (finalize_component): Use expr->finalized instead of
comp->finalized.
* gfortran.h (gfc_component): Remove finalized member.
(gfc_expr): Add it here instead.
gcc/testsuite/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* gfortran.dg/finalize_28.f90: Adjusted free counts.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: Likewise.
* gfortran.dg/finalize_35.f90: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (7 preceding siblings ...)
2020-05-31 10:00 ` cvs-commit at gcc dot gnu.org
@ 2020-06-01 18:16 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:33 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-01 18:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:
https://gcc.gnu.org/g:b703627d668257c0955a43838288e91973bf2721
commit r10-8218-gb703627d668257c0955a43838288e91973bf2721
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date: Sun May 31 10:26:40 2020 +0200
Finalization depends on the expression, not on the component.
This patch fixes a 8/9/10/11 regression, where finalized types
were not finalized (and deallocated), which led to memory
leaks.
gcc/fortran/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* class.c (finalize_component): Use expr->finalized instead of
comp->finalized.
* gfortran.h (gfc_component): Remove finalized member.
(gfc_expr): Add it here instead.
gcc/testsuite/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* gfortran.dg/finalize_28.f90: Adjusted free counts.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: Likewise.
* gfortran.dg/finalize_35.f90: New test.
(cherry picked from commit 811f902b764c5a13178cbd7588e96c16b3fab504)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (8 preceding siblings ...)
2020-06-01 18:16 ` cvs-commit at gcc dot gnu.org
@ 2020-06-01 18:33 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:49 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:52 ` tkoenig at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-01 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:
https://gcc.gnu.org/g:2a0de88ccf2ecc6659b0f1e4580c1ce5cff976b3
commit r9-8643-g2a0de88ccf2ecc6659b0f1e4580c1ce5cff976b3
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date: Sun May 31 10:26:40 2020 +0200
Finalization depends on the expression, not on the component.
This patch fixes a 8/9/10/11 regression, where finalized types
were not finalized (and deallocated), which led to memory
leaks.
gcc/fortran/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* class.c (finalize_component): Use expr->finalized instead of
comp->finalized.
* gfortran.h (gfc_component): Remove finalized member.
(gfc_expr): Add it here instead.
gcc/testsuite/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* gfortran.dg/finalize_28.f90: Adjusted free counts.
* gfortran.dg/finalize_33.f90: Likewise.
* gfortran.dg/finalize_34.f90: Likewise.
* gfortran.dg/finalize_35.f90: New test.
(cherry picked from commit 811f902b764c5a13178cbd7588e96c16b3fab504)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (9 preceding siblings ...)
2020-06-01 18:33 ` cvs-commit at gcc dot gnu.org
@ 2020-06-01 18:49 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:52 ` tkoenig at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-01 18:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:
https://gcc.gnu.org/g:75f5824b77632ef583a7a65302b326e8bf1b851c
commit r8-10289-g75f5824b77632ef583a7a65302b326e8bf1b851c
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date: Sun May 31 10:26:40 2020 +0200
Finalization depends on the expression, not on the component.
This patch fixes a 8/9/10/11 regression, where finalized types
were not finalized (and deallocated), which led to memory
leaks.
gcc/fortran/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* class.c (finalize_component): Use expr->finalized instead of
comp->finalized.
* gfortran.h (gfc_component): Remove finalized member.
(gfc_expr): Add it here instead.
gcc/testsuite/ChangeLog:
2020-05-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94361
* gfortran.dg/finalize_28.f90: Adjusted free counts.
* gfortran.dg/finalize_34.f90: Likewise.
* gfortran.dg/finalize_35.f90: New test.
(cherry picked from commit 2a0de88ccf2ecc6659b0f1e4580c1ce5cff976b3)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/94361] [8/9/10/11 Regression] Memory leak in nested types with final
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
` (10 preceding siblings ...)
2020-06-01 18:49 ` cvs-commit at gcc dot gnu.org
@ 2020-06-01 18:52 ` tkoenig at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-01 18:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed on all open branches.
Thanks for the bug report!
^ permalink raw reply [flat|nested] 13+ messages in thread