[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 Mikael Morin changed: What|Removed |Added CC||mikael at gcc dot gnu.org --- Comment #1 from Mikael Morin --- This seems to do the trick for this testcase: diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index f1e55316e5b..f7670591fad 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -3864,9 +3864,6 @@ loop: accept_statement (st); prog_unit = gfc_new_block; prog_unit->formal_ns = gfc_current_ns; - if (prog_unit == prog_unit->formal_ns->proc_name - && prog_unit->ns != prog_unit->formal_ns) -prog_unit->refs++; decl: /* Read data declaration statements. */ I can't fully test it right now.
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 --- Comment #2 from Mikael Morin --- Interestingly, the three lines removed in the previous comment come from a fix for PR41093, whose title is "memory leaks with gfc_namespace".
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 anlauf at gcc dot gnu.org changed: What|Removed |Added Keywords||memory-hog --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to Mikael Morin from comment #1) > This seems to do the trick for this testcase: [...] > I can't fully test it right now. Regtests cleanly on x86_64-pc-linux-gnu here, and passes further tests. And yes, the memleak is gone for the example.
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 --- Comment #4 from anlauf at gcc dot gnu.org --- Mikael, are you still onto it?
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 Mikael Morin changed: What|Removed |Added Last reconfirmed||2023-09-08 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |mikael at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #5 from Mikael Morin --- (In reply to anlauf from comment #4) > Mikael, > > are you still onto it? Thanks for the reminder. This PR had disappeared from my radar. Taking it.
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 --- Comment #6 from CVS Commits --- The master branch has been updated by Mikael Morin : https://gcc.gnu.org/g:e6dba708c8627080f4ca776590a191683b38336c commit r14-4021-ge6dba708c8627080f4ca776590a191683b38336c Author: Mikael Morin Date: Fri Sep 15 13:40:08 2023 +0200 fortran: Remove reference count update [PR108957] Remove one reference count incrementation following the assignment of a symbol pointer to a local variable. Most symbol pointers are "weak" pointer and don't need any reference count update when they are assigned, and it is especially the case of local variables. This fixes a memory leak with the testcase from the PR (not included). PR fortran/108957 gcc/fortran/ChangeLog: * gfortran.h (gfc_symbol): Add comment documenting reference counting. * parse.cc (parse_interface): Remove reference count incrementation.
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 Mikael Morin changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #7 from Mikael Morin --- Fixed for gfortran 14, closing.
[Bug fortran/108957] Fortran FE memleak with interfaces
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108957 Mikael Morin changed: What|Removed |Added Target Milestone|--- |14.0