This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR29101 - Memory leak in select case with character expression
- From: "Steven Bosscher" <stevenb dot gcc at gmail dot com>
- To: "Paul Thomas" <paulthomas2 at wanadoo dot fr>
- Cc: gcc-patches at gcc dot gnu dot org, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Tue, 19 Sep 2006 00:39:17 +0200
- Subject: Re: [Patch, fortran] PR29101 - Memory leak in select case with character expression
- References: <450ED3EB.5000008@wanadoo.fr> <200609181924.28246.steven@gcc.gnu.org> <450EFAD5.1010001@wanadoo.fr>
On 9/18/06, Paul Thomas <paulthomas2@wanadoo.fr> wrote:
Bingo! You're right.... It was just too "obvious" wasn't it. I posted
a corrected version with the PR.
Paul,
What you now commited is still wrong.
pstr.6 = (char[1:D.960] *) _gfortran_internal_malloc (D.960);
tolower (pstr.6, D.960, D.958, D.959);
goto _gfortran_select_string ((void *) &jumptable.5, 2, &L.5, pstr.6,
D.960);
L.4:;
*value = 1;
goto L.5;
L.3:;
__result_validate_value = 0;
goto L.5;
L.5:;
_gfortran_internal_free ((void *) pstr.6);
For example, what if one of the CASEs jumps to a label beyond the end
of the SELECT? Like so:
LOGICAL FUNCTION foo(str)
USE stringutils
CHARACTER(len=*), INTENT(in) :: str
SELECT CASE (tolower(str))
CASE ("x"):
foo = .TRUE.
GOTO 10
CASE DEFAULT
foo = .FALSE.
END SELECT
10 CONTINUE
END FUNCTION
I bet this still leaks.
Gr.
Steven
Gr.
Steven