From: Harald Anlauf <anlauf@gmx.de>
To: fortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH, committed] Fortran: frontend passes do_subscript leaks gmp memory [PR108924]
Date: Fri, 24 Feb 2023 21:38:25 +0100 [thread overview]
Message-ID: <trinity-726fb111-e89a-40c0-8abb-5ed9970c20fb-1677271105148@3c-app-gmx-bs39> (raw)
[-- 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
reply other threads:[~2023-02-24 20:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-726fb111-e89a-40c0-8abb-5ed9970c20fb-1677271105148@3c-app-gmx-bs39 \
--to=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).