public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/68800] Fortran FE produces many memory leaks
       [not found] <bug-68800-4@http.gcc.gnu.org/bugzilla/>
@ 2021-11-09 20:57 ` cvs-commit at gcc dot gnu.org
  2021-11-09 21:31 ` aldot at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-09 20:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68800

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bernhard Reutner-Fischer
<aldot@gcc.gnu.org>:

https://gcc.gnu.org/g:8875a92d31329ae52b734683784c4b054839a661

commit r12-5073-g8875a92d31329ae52b734683784c4b054839a661
Author: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Date:   Fri Oct 12 23:57:21 2018 +0200

    Fortran: Fix memory leak in finalization wrappers [PR68800]

    If a finalization is not required we created a namespace containing
    formal arguments for an internal interface definition but never used
    any of these. So the whole sub_ns namespace was not wired up to the
    program and consequently was never freed. The fix is to simply not
    generate any finalization wrappers if we know that it will be unused.
    Note that this reverts back to the original r190869
    (8a96d64282ac534cb597f446f02ac5d0b13249cc) handling for this case
    by reverting this specific part of r194075
    (f1ee56b4be7cc3892e6ccc75d73033c129098e87) for PR fortran/37336.

    valgrind summary for e.g.
    gfortran.dg/abstract_type_3.f03 and gfortran.dg/abstract_type_4.f03
    where ".orig" is pristine trunk and ".mine" contains this fix:

    at3.orig.vg:LEAK SUMMARY:
    at3.orig.vg-   definitely lost: 8,460 bytes in 11 blocks
    at3.orig.vg-   indirectly lost: 13,288 bytes in 55 blocks
    at3.orig.vg-     possibly lost: 0 bytes in 0 blocks
    at3.orig.vg-   still reachable: 572,278 bytes in 2,142 blocks
    at3.orig.vg-        suppressed: 0 bytes in 0 blocks
    at3.orig.vg-
    at3.orig.vg-Use --track-origins=yes to see where uninitialised values come
from
    at3.orig.vg-ERROR SUMMARY: 38 errors from 33 contexts (suppressed: 0 from
0)
    --
    at3.mine.vg:LEAK SUMMARY:
    at3.mine.vg-   definitely lost: 344 bytes in 1 blocks
    at3.mine.vg-   indirectly lost: 7,192 bytes in 18 blocks
    at3.mine.vg-     possibly lost: 0 bytes in 0 blocks
    at3.mine.vg-   still reachable: 572,278 bytes in 2,142 blocks
    at3.mine.vg-        suppressed: 0 bytes in 0 blocks
    at3.mine.vg-
    at3.mine.vg-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    at3.mine.vg-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    at4.orig.vg:LEAK SUMMARY:
    at4.orig.vg-   definitely lost: 13,751 bytes in 12 blocks
    at4.orig.vg-   indirectly lost: 11,976 bytes in 60 blocks
    at4.orig.vg-     possibly lost: 0 bytes in 0 blocks
    at4.orig.vg-   still reachable: 572,278 bytes in 2,142 blocks
    at4.orig.vg-        suppressed: 0 bytes in 0 blocks
    at4.orig.vg-
    at4.orig.vg-Use --track-origins=yes to see where uninitialised values come
from
    at4.orig.vg-ERROR SUMMARY: 18 errors from 16 contexts (suppressed: 0 from
0)
    --
    at4.mine.vg:LEAK SUMMARY:
    at4.mine.vg-   definitely lost: 3,008 bytes in 3 blocks
    at4.mine.vg-   indirectly lost: 4,056 bytes in 11 blocks
    at4.mine.vg-     possibly lost: 0 bytes in 0 blocks
    at4.mine.vg-   still reachable: 572,278 bytes in 2,142 blocks
    at4.mine.vg-        suppressed: 0 bytes in 0 blocks
    at4.mine.vg-
    at4.mine.vg-ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
    at4.mine.vg-ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)

    gcc/fortran/ChangeLog:

    2018-10-12  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

            PR fortran/68800
            * class.c (generate_finalization_wrapper): Do not leak
            finalization wrappers if they will not be used.
            * expr.c (gfc_free_actual_arglist): Formatting fix.
            * gfortran.h (gfc_free_symbol): Pass argument by reference.
            (gfc_release_symbol): Likewise.
            (gfc_free_namespace): Likewise.
            * symbol.c (gfc_release_symbol): Adjust acordingly.
            (free_components): Set procedure pointer components
            of derived types to NULL after freeing.
            (free_tb_tree): Likewise.
            (gfc_free_symbol): Set sym to NULL after freeing.
            (gfc_free_namespace): Set namespace to NULL after freeing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/68800] Fortran FE produces many memory leaks
       [not found] <bug-68800-4@http.gcc.gnu.org/bugzilla/>
  2021-11-09 20:57 ` [Bug fortran/68800] Fortran FE produces many memory leaks cvs-commit at gcc dot gnu.org
@ 2021-11-09 21:31 ` aldot at gcc dot gnu.org
  2023-02-24 20:45 ` anlauf at gcc dot gnu.org
  2023-05-08  5:56 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: aldot at gcc dot gnu.org @ 2021-11-09 21:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68800

--- Comment #6 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> ---
at least a few down with r12-5073:

 == LEAK SUMMARY:
-==    definitely lost: 9,471 bytes in 14 blocks
-==    indirectly lost: 18,267 bytes in 364 blocks
+==    definitely lost: 6,472 bytes in 8 blocks
+==    indirectly lost: 15,683 bytes in 346 blocks
 ==      possibly lost: 0 bytes in 0 blocks
 ==    still reachable: 1,442,175 bytes in 1,244 blocks
 ==         suppressed: 0 bytes in 0 blocks
 == 
 == For lists of detected and suppressed errors, rerun with: -s
-== ERROR SUMMARY: 13 errors from 13 contexts (suppressed: 0 from 0)
+== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/68800] Fortran FE produces many memory leaks
       [not found] <bug-68800-4@http.gcc.gnu.org/bugzilla/>
  2021-11-09 20:57 ` [Bug fortran/68800] Fortran FE produces many memory leaks cvs-commit at gcc dot gnu.org
  2021-11-09 21:31 ` aldot at gcc dot gnu.org
@ 2023-02-24 20:45 ` anlauf at gcc dot gnu.org
  2023-05-08  5:56 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-24 20:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68800

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #7 from anlauf at gcc dot gnu.org ---
gfortran.dg/gomp/associate1.f90 is another candidate showing one of the
tracebacks as in comment#0, even without -fopenmp:

==5113== 224 bytes in 1 blocks are definitely lost in loss record 276 of 356
==5113==    at 0x4C39571: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5113==    by 0x205F054: xcalloc (xmalloc.c:164)
==5113==    by 0x8F891F: gfc_get_expr() (expr.cc:49)
==5113==    by 0x96ED01: gfc_match_rvalue(gfc_expr**) (primary.cc:3831)
==5113==    by 0x9338DE: match_primary (matchexp.cc:157)
==5113==    by 0x9338DE: match_level_1 (matchexp.cc:211)
==5113==    by 0x9338DE: match_mult_operand(gfc_expr**) (matchexp.cc:267)
==5113==    by 0x933C18: match_add_operand(gfc_expr**) (matchexp.cc:356)
==5113==    by 0x933F0F: match_level_2(gfc_expr**) (matchexp.cc:480)
==5113==    by 0x9340D6: match_level_3(gfc_expr**) (matchexp.cc:551)
==5113==    by 0x934212: match_level_4 (matchexp.cc:599)
==5113==    by 0x934212: match_and_operand(gfc_expr**) (matchexp.cc:693)
==5113==    by 0x9343F6: match_or_operand(gfc_expr**) (matchexp.cc:722)
==5113==    by 0x934506: match_equiv_operand(gfc_expr**) (matchexp.cc:765)
==5113==    by 0x934618: match_level_5(gfc_expr**) (matchexp.cc:811)
==5113== 
==5113== 3,232 (672 direct, 2,560 indirect) bytes in 3 blocks are definitely
lost in loss record 322 of 356
==5113==    at 0x4C39571: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5113==    by 0x205F054: xcalloc (xmalloc.c:164)
==5113==    by 0x8F891F: gfc_get_expr() (expr.cc:49)
==5113==    by 0x96EABE: gfc_match_rvalue(gfc_expr**) (primary.cc:3579)
==5113==    by 0x9338DE: match_primary (matchexp.cc:157)
==5113==    by 0x9338DE: match_level_1 (matchexp.cc:211)
==5113==    by 0x9338DE: match_mult_operand(gfc_expr**) (matchexp.cc:267)
==5113==    by 0x933C18: match_add_operand(gfc_expr**) (matchexp.cc:356)
==5113==    by 0x933F0F: match_level_2(gfc_expr**) (matchexp.cc:480)
==5113==    by 0x9340D6: match_level_3(gfc_expr**) (matchexp.cc:551)
==5113==    by 0x934212: match_level_4 (matchexp.cc:599)
==5113==    by 0x934212: match_and_operand(gfc_expr**) (matchexp.cc:693)
==5113==    by 0x9343F6: match_or_operand(gfc_expr**) (matchexp.cc:722)
==5113==    by 0x934506: match_equiv_operand(gfc_expr**) (matchexp.cc:765)
==5113==    by 0x934618: match_level_5(gfc_expr**) (matchexp.cc:811)
==5113== 
==5113== 4,864 (448 direct, 4,416 indirect) bytes in 2 blocks are definitely
lost in loss record 329 of 356
==5113==    at 0x4C39571: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5113==    by 0x205F054: xcalloc (xmalloc.c:164)
==5113==    by 0x8F891F: gfc_get_expr() (expr.cc:49)
==5113==    by 0x96ED72: gfc_match_rvalue(gfc_expr**) (primary.cc:3816)
==5113==    by 0x9338DE: match_primary (matchexp.cc:157)
==5113==    by 0x9338DE: match_level_1 (matchexp.cc:211)
==5113==    by 0x9338DE: match_mult_operand(gfc_expr**) (matchexp.cc:267)
==5113==    by 0x933C18: match_add_operand(gfc_expr**) (matchexp.cc:356)
==5113==    by 0x933F0F: match_level_2(gfc_expr**) (matchexp.cc:480)
==5113==    by 0x9340D6: match_level_3(gfc_expr**) (matchexp.cc:551)
==5113==    by 0x934212: match_level_4 (matchexp.cc:599)
==5113==    by 0x934212: match_and_operand(gfc_expr**) (matchexp.cc:693)
==5113==    by 0x9343F6: match_or_operand(gfc_expr**) (matchexp.cc:722)
==5113==    by 0x934506: match_equiv_operand(gfc_expr**) (matchexp.cc:765)
==5113==    by 0x934618: match_level_5(gfc_expr**) (matchexp.cc:811)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/68800] Fortran FE produces many memory leaks
       [not found] <bug-68800-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-02-24 20:45 ` anlauf at gcc dot gnu.org
@ 2023-05-08  5:56 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-08  5:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68800

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bernhard Reutner-Fischer
<aldot@gcc.gnu.org>:

https://gcc.gnu.org/g:2521390dd2f8e554ecccb380e0efd7aa21cd4b5f

commit r14-567-g2521390dd2f8e554ecccb380e0efd7aa21cd4b5f
Author: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Date:   Sun May 7 00:02:21 2023 +0200

    Fortran: Fix mpz and mpfr memory leaks [PR fortran/68800]

    gcc/fortran/ChangeLog:

            PR fortran/68800
            * expr.cc (find_array_section): Fix mpz memory leak.
            * simplify.cc (gfc_simplify_reshape): Fix mpz memory leaks in
            error paths.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-08  5:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-68800-4@http.gcc.gnu.org/bugzilla/>
2021-11-09 20:57 ` [Bug fortran/68800] Fortran FE produces many memory leaks cvs-commit at gcc dot gnu.org
2021-11-09 21:31 ` aldot at gcc dot gnu.org
2023-02-24 20:45 ` anlauf at gcc dot gnu.org
2023-05-08  5:56 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).