* [PATCH, committed] Fortran: frontend passes do_subscript leaks gmp memory [PR108924]
@ 2023-02-24 20:38 Harald Anlauf
0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2023-02-24 20:38 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
Dear all,
as reported by Richard - although without a testcase - we leak
gmp memory in do_subscript(). The attached patch was derived
by inspection of the code pointed at by valgrind and regtested
on x86_64-pc-linux-gnu.
Committed as obvious as
commit r13-6336-g45f406c4f62e516b58dcda20b5a7aa43ff0aa0f3
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Feb 24 19:56:32 2023 +0100
Thanks,
Harald
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr108924.diff --]
[-- Type: text/x-patch, Size: 942 bytes --]
From 45f406c4f62e516b58dcda20b5a7aa43ff0aa0f3 Mon Sep 17 00:00:00 2001
From: Harald Anlauf <anlauf@gmx.de>
Date: Fri, 24 Feb 2023 19:56:32 +0100
Subject: [PATCH] Fortran: frontend passes do_subscript leaks gmp memory
[PR108924]
gcc/fortran/ChangeLog:
PR fortran/108924
* frontend-passes.cc (do_subscript): Clear used gmp variable.
---
gcc/fortran/frontend-passes.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc
index 02fcb41dbc4..90428982023 100644
--- a/gcc/fortran/frontend-passes.cc
+++ b/gcc/fortran/frontend-passes.cc
@@ -2883,7 +2883,10 @@ do_subscript (gfc_expr **e)
have_do_end = false;
if (!have_do_start && !have_do_end)
- return 0;
+ {
+ mpz_clear (do_step);
+ return 0;
+ }
/* No warning inside a zero-trip loop. */
if (have_do_start && have_do_end)
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-24 20:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 20:38 [PATCH, committed] Fortran: frontend passes do_subscript leaks gmp memory [PR108924] Harald Anlauf
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).