[Patch, fortran] PR29101 - Memory leak in select case with character expression
Steven Bosscher
stevenb.gcc@gmail.com
Mon Sep 18 22:39:00 GMT 2006
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
More information about the Fortran
mailing list