[Patch, fortran] PR29101 - Memory leak in select case with character expression

Steven Bosscher stevenb.gcc@gmail.com
Tue Sep 19 05:31:00 GMT 2006


On 9/19/06, Paul Thomas <paulthomas2@wanadoo.fr> wrote:
> Steven,
>
> >
> >
> > I bet this still leaks.
>
> I'll grant you that - still, what I committed is an improvement; I'll
> re-open the PR, modify it appropriately and figure out what to do in the
> longer run.

I think you need to assign the result of the character  select to a
temporary, then free, then jump.  I.e. something like this:


  pstr.6 = (char[1:D.960] *) _gfortran_internal_malloc (D.960);
  tolower (pstr.6, D.960, D.958, D.959);
  character_select_tmp =  _gfortran_select_string ((void *)
&jumptable.5, 2, &L.5, pstr.6,
D.960);
  _gfortran_internal_free ((void *) pstr.6);
  goto character_select_tmp;

  L.4:;
  *value = 1;
  goto L.5;
  L.3:;
  __result_validate_value = 0;
  goto L.5;
  L.5:;

Gr.
Steven



More information about the Fortran mailing list